🚀 Deploy a Static Website on Azure App Service Using ARM Template and Azure CLI
In this tutorial, I’ll walk you through deploying a static website using Azure App Service with an ARM template, running commands from VS Code, and fixing issues that came up along the way.
🔧 Step 1: Set Up Your WebApp Template
Open your template.json
in VS Code. This defines two resources:
- An App Service Plan
- A Web App
{
"resources": [
{
"type": "Microsoft.Web/serverfarms",
...
},
{
"type": "Microsoft.Web/sites",
...
}
]
}
📂 Step 2: Create and Enter the Webapp Folder
cd webapp
🧱 Step 3: Create the Resource Group
az group create -n dolamyRG -l westus
📦 Step 4: Deploy the ARM Template
az deployment group create --resource-group dolamyRG --template-file template.json --parameters parameters.json
You might run into this error:
(ResourceNotFound) The Resource 'Microsoft.Web/sites/dolaApp4356' was not found...
🛠️ Step 5: Fixing the Missing WebApp Name Error
The fix is to manually create the app service plan and the webapp.
az appservice plan create --name MyPlan --resource-group dolamyRG --sku FREE
az webapp create --name dolaApp4356 --resource-group dolamyRG --plan MyPlan
🌐 Step 6: Link GitHub Repository to the WebApp
az webapp deployment source config --name dolaApp4356 --resource-group dolamyRG --repo-url https://github.com/yourtechie/fruitables --branch master --manual-integration
🔍 Step 7: Get the WebApp URL
az webapp show --name dolaApp4356 --resource-group dolamyRG --query defaultHostName --output tsv
This will return something like:
dolaApp4356.azurewebsites.net
✅ Result
Visit your site:
You’re live!
📝 Summary
Step | Action |
---|---|
1 | Create webapp template |
2 | Enter project directory |
3 | Create resource group |
4 | Deploy template |
5 | Fix missing resource with manual creation |
6 | Connect GitHub repo |
7 | Get your live link |