author | ms.author | ms.topic | ms.date |
---|---|---|---|
charris-msft |
charris |
include |
06/28/2022 |
Azure CLI commands can be run on a computer with the Azure CLI installed.
Azure CLI has a command az webapp up
that will create the necessary resources and deploy your application in a single step.
If necessary, log in to Azure using az login.
az login
Create the webapp and other resources, then deploy your code to Azure using az webapp up.
az webapp up --runtime PYTHON:3.9 --sku B1 --logs
- The
--runtime
parameter specifies what version of Python your app is running. This example uses Python 3.9. To list all available runtimes, use the commandaz webapp list-runtimes --os linux --output table
. - The
--sku
parameter defines the size (CPU, memory) and cost of the app service plan. This example uses the B1 (Basic) service plan, which will incur a small cost in your Azure subscription. For a full list of App Service plans, view the App Service pricing page. - The
--logs
flag configures default logging required to enable viewing the log stream immediately after launching the webapp. - You can optionally specify a name with the argument
--name <app-name>
. If you don't provide one, then a name will be automatically generated. - You can optionally include the argument
--location <location-name>
where<location_name>
is an available Azure region. You can retrieve a list of allowable regions for your Azure account by running theaz appservice list-locations
command.
The command may take a few minutes to complete. While the command is running, it provides messages about creating the resource group, the App Service plan, and the app resource, configuring logging, and doing ZIP deployment. It then gives the message, "You can launch the app at http://<app-name>.azurewebsites.net", which is the app's URL on Azure.
The webapp '<app-name>' doesn't exist Creating Resource group '<group-name>' ... Resource group creation complete Creating AppServicePlan '<app-service-plan-name>' ... Creating webapp '<app-name>' ... Configuring default logging for the app, if not already enabled Creating zip with contents of dir /home/cephas/myExpressApp ... Getting scm site credentials for zip deployment Starting zip deployment. This operation can take a while to complete ... Deployment endpoint responded with status code 202 You can launch the app at http://<app-name>.azurewebsites.net { "URL": "http://<app-name>.azurewebsites.net", "appserviceplan": "<app-service-plan-name>", "location": "centralus", "name": "<app-name>", "os": "<os-type>", "resourcegroup": "<group-name>", "runtime_version": "python|3.9", "runtime_version_detected": "0.0", "sku": "FREE", "src_path": "<your-folder-location>" }
[!INCLUDE az webapp up command note]