Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
If you’ve ever built Azure resources manually in the portal, you know it can be time-consuming and prone to human error. That’s where ARM templates (Azure Resource Manager templates) come in—they allow you to define your infrastructure as code, making deployments consistent, repeatable, and automated.
In this post, we’ll walk through creating an ARM template for an Azure Web App and deploying it using the Azure CLI. By the end, you’ll have a working web app and a solid understanding of how ARM templates streamline cloud automation.
ARM (Azure Resource Manager) templates are JSON-based files that define Azure resources. Instead of manually configuring services in the portal, you describe the desired state once in a template, then deploy it as many times as you want.
Benefits of ARM templates:
Beyond just avoiding the manual grind, ARM templates offer several key benefits for automating resource creation:
Before writing templates, we’ll set up a few tools:
To check if you have the Azure CLI installed, run:
az version
If not installed, you can install it with WinGet on Windows:
winget install -e --id Microsoft.AzureCLI
Once installed, restart your terminal and verify the az command is available.
Let’s create a file named web-app.json inside VS Code.
An ARM template follows a schema and contains several root properties:
The App Service Plan is required to host a web app. Using VS Code snippets (arm-plan), define it as:
{
"type": "Microsoft.Web/serverfarms",
"apiVersion": "2022-03-01",
"name": "arm-web-app-plan",
"location": "[resourceGroup().location]",
"sku": {
"name": "F1",
"tier": "Free"
},
"properties": {
"name": "arm-web-app-plan"
}
}
💡 Note: The F1 (Free) tier only allows one free plan per region.
Next, add the web app itself using the arm-web-app snippet:
{
"type": "Microsoft.Web/sites",
"apiVersion": "2022-03-01",
"name": "arm-web-app-demo",
"location": "[resourceGroup().location]",
"dependsOn": [
"[resourceId('Microsoft.Web/serverfarms', 'arm-web-app-plan')]"
],
"properties": {
"serverFarmId": "[resourceId('Microsoft.Web/serverfarms', 'arm-web-app-plan')]"
}
}
ARM templates are more than just JSON files—they’re a way to bring automation, repeatability, and scalability into your Azure projects. Whether you’re setting up a simple storage account or an entire enterprise-grade infrastructure, ARM templates save you time and reduce mistakes.
If you’re just starting out, try creating a small template (like the storage account example above). Once you’re comfortable, you can expand into more complex solutions and even integrate them into your CI/CD pipelines.
Automation is the future, and ARM templates are your ticket to building smarter in Azure.
This tells Azure:
Now that the template is ready, let’s deploy it.
az login
This opens a browser window for authentication.
Create a Resource Group (if you don’t have one already):
az group create --name myResourceGroup --location eastus
Deploy the Template:
az deployment group create \
--resource-group myResourceGroup \
--template-file web-app.json
If successful, Azure returns a JSON output with details of the deployment.
Head over to the Azure Portal, open your Resource Group, and hit refresh. You should see:
arm-web-app-planarm-web-app-demoBoth resources are live, and the web app is ready to be configured or deployed with your code.
This example shows just the basics of ARM templates. You can take it further by:
By defining infrastructure in an ARM template and deploying it with the Azure CLI, you’ve automated what would otherwise be several manual steps in the portal. This approach ensures consistency, saves time, and sets you on the path toward full Infrastructure as Code (IaC).
In upcoming posts, we’ll explore Bicep—ARM’s modern successor—for an even smoother developer experience.
🚀 Ready to give it a try? Open VS Code, create your first ARM template, and watch your Azure resources spin up automatically!
Click here to add the full JSON of the combined template (App Service Plan + Web App)