Create the App Service

Previous step: Create the app

In this step, you use the Azure CLI to create the Azure App Service to host your app code.

Create resource group and set as default value

  1. At a terminal or command prompt, use the following command to create a resource group for the App Service. A resource group is essentially a named collection of an app's resources in Azure, such as a website, a database, Azure Functions, etc.

    az group create --name myResourceGroup --location westus

    The Azure CLI command, az group create above creates a resource group called myResourceGroup in the westus data center. You can change these values as desired.

    Once the command runs successfully, it displays JSON output with the details of the resource group.

  2. Run the following Azure CLI command, az configure, to set the default resource group and region for subsequent commands. Doing so avoids the need to specify these values each time. (This command has no output on success.)

    az configure --defaults group=myResourceGroup location=westus

Create and deploy web app service with Azure CLI command

Run the following Azure CLI command, az webapp up, to create and deploy the App Service app. Replace <your_app_name> with a unique name that becomes the URL, http://<your_app_name>

az webapp up --name <your_app_name> --logs --launch-browser

The --logs command displays the log stream immediately after launching the webapp. The --launch-browser command opens the default browser to the new app. You can use the same command to redeploy the entire app again.


  • If you received an error about a missing but required parameter, --resource-group, return to the top of the article and set the defaults or provide the parameter and value.

Next steps

Learn more commands for your webapp with either the Azure webapp command group or the Azure App service command group.