Create an Azure App Service
This guide walks you through the process of creating a new Azure App Service using the Azure portal and Azure CLI.
Using the Azure Portal
Make sure you have an active Azure subscription. If not, you can sign up for a free account.
Steps:
-
Navigate to the App Services Page:
Log in to the Azure portal. In the search bar at the top, type "App Services" and select it from the results.
-
Create New App Service:
Click on the + Create button or + Add button. Select App Service from the dropdown.
-
Configure Basic Settings:
- Subscription: Choose your Azure subscription.
- Resource Group: Create a new resource group or select an existing one. A resource group is a logical container for your Azure resources.
- Name: Enter a globally unique name for your web app. This will be part of the URL (e.g.,
your-app-name.azurewebsites.net
). - Publish: Choose how you want to publish your code (e.g., Code, Docker Container).
- Runtime Stack: Select the language and version for your application (e.g., .NET Core 6, Node 18 LTS, Python 3.10).
- Operating System: Choose between Windows and Linux.
- Region: Select the Azure region closest to your users for better performance.
-
Configure Hosting:
- App Service Plan: Choose an existing App Service plan or create a new one. The plan defines the underlying compute resources, location, and pricing tier.
- Pricing Tier: Select a tier that suits your needs (e.g., Free, Shared, Basic, Standard, Premium).
-
Review and Create:
Review all the settings you've configured. You can also explore additional settings like Deployment, Networking, Monitoring, etc., under the respective tabs.
Click the Review + create button. After validation passes, click Create.
-
Deployment:
Azure will provision your App Service. This may take a few minutes. Once completed, you will see a "Deployment succeeded" message.
Using the Azure CLI
Ensure you have the Azure CLI installed and logged in. You can install it from here.
Steps:
-
Login to Azure:
az login
-
Create a Resource Group (if needed):
Replace
myResourceGroup
with your desired resource group name andeastus
with your preferred region.az group create --name myResourceGroup --location eastus
-
Create an App Service Plan:
This command creates a Linux App Service plan in the Free F1 tier. You can change the name (
myAppServicePlan), OS (
--is-linux
or--is-windows
), and SKU (e.g.,B1
for Basic).az appservice plan create --name myAppServicePlan --resource-group myResourceGroup --is-linux --sku F1
-
Create the Web App:
Replace
my-unique-app-name
with your desired app name andmyAppServicePlan
with the name of the plan you created.az webapp create --resource-group myResourceGroup --plan myAppServicePlan --name my-unique-app-name
If you want to specify a runtime stack (e.g., Node.js), you can add the
--runtime
flag. For example, for Node 18 LTS:az webapp create --resource-group myResourceGroup --plan myAppServicePlan --name my-unique-app-name --runtime "NODE|18-lts"
-
Verify Creation:
You can list your web apps to confirm creation:
az webapp list --resource-group myResourceGroup