0
0
AzureHow-ToBeginner · 4 min read

How to Create App Service in Azure: Step-by-Step Guide

To create an App Service in Azure, use the az webapp create command with a resource group, app service plan, and app name. This sets up a web app hosting environment ready for your application code.
📐

Syntax

The basic command to create an Azure App Service is:

az webapp create --resource-group <resource-group-name> --plan <app-service-plan> --name <app-name> --runtime <runtime>

Explanation of parts:

  • --resource-group: The Azure resource group to contain the app.
  • --plan: The App Service plan that defines the compute resources.
  • --name: The unique name of your web app.
  • --runtime: The runtime stack your app will use (e.g., NODE|14-lts, DOTNETCORE|6.0).
bash
az webapp create --resource-group MyResourceGroup --plan MyAppServicePlan --name MyUniqueAppName --runtime "DOTNETCORE|6.0"
💻

Example

This example creates a new App Service named myappservice123 in the resource group MyResourceGroup using the plan MyPlan with a Node.js 14 runtime.

bash
az group create --name MyResourceGroup --location eastus
az appservice plan create --name MyPlan --resource-group MyResourceGroup --sku B1 --is-linux
az webapp create --resource-group MyResourceGroup --plan MyPlan --name myappservice123 --runtime "NODE|14-lts"
Output
ResourceGroup 'MyResourceGroup' created. AppServicePlan 'MyPlan' created. Webapp 'myappservice123' created.
⚠️

Common Pitfalls

  • Using a non-unique app name causes creation to fail because app names must be globally unique.
  • Not creating or specifying an App Service plan will cause errors; the plan defines the hosting resources.
  • Choosing an unsupported runtime string leads to deployment failure; check Azure documentation for valid runtime values.
bash
Wrong:
az webapp create --resource-group MyResourceGroup --plan MyPlan --name existingappname --runtime "PYTHON|3.7"

Right:
az webapp create --resource-group MyResourceGroup --plan MyPlan --name uniqueappname123 --runtime "PYTHON|3.7"
📊

Quick Reference

ParameterDescriptionExample
--resource-groupName of the Azure resource groupMyResourceGroup
--planApp Service plan nameMyAppServicePlan
--nameUnique web app namemyappservice123
--runtimeRuntime stack for the appNODE|14-lts
--skuPricing tier for the planB1 (Basic)
--is-linuxUse Linux OS for the apptrue

Key Takeaways

Use the az CLI command 'az webapp create' with resource group, plan, name, and runtime to create an Azure App Service.
Ensure your app name is globally unique to avoid creation errors.
Create an App Service plan before creating the web app to define hosting resources.
Choose a supported runtime string matching your app's technology stack.
Use 'az group create' and 'az appservice plan create' commands to prepare resources before creating the app.