Azure ARM Templates Cheat Sheet
Azure Resource Manager template structure, resources, parameters, variables, outputs, and deployment commands.
Containers & Cloud
azure
arm
infrastructure
Azure Resource Manager (ARM) templates describe Azure infrastructure as declarative JSON. A template is a schema-versioned document with parameters, variables, resources, and outputs deployed to a resource group or subscription.
Template anatomy
json
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": { "type": "string", "defaultValue": "[resourceGroup().location]" },
"storageName": { "type": "string", "defaultValue": "mystorageaccount" }
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2022-09-01",
"name": "[parameters('storageName')]",
"location": "[parameters('location')]",
"sku": { "name": "Standard_LRS" }
}
],
"outputs": {
"storageId": { "type": "string", "value": "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageName'))]" }
}
}
Table
| Section | Purpose |
|---|---|
$schema | Template schema URL. |
contentVersion | Template version string. |
parameters | User-supplied inputs. |
variables | Reusable computed values. |
resources | Azure resources to deploy (required). |
outputs | Values returned after deployment. |
Template functions
Table
| Function | Purpose |
|---|---|
resourceId(...) | Build a resource ID. |
concat(...) | Concatenate strings. |
resourceGroup() | Read the target resource group. |
subscription() | Read the subscription. |
parameters('name') | Read a parameter. |
variables('name') | Read a variable. |
reference(...) | Read a deployed resource's runtime properties. |
Deployment CLI
bash
az deployment group validate --resource-group demo --template-file template.json
az deployment group create --resource-group demo --template-file template.json --parameters location=eastus
az deployment group list --resource-group demo
az deployment group show --resource-group demo --name demo
az group delete --name demo --yes
Table
| Command | Purpose |
|---|---|
validate | Check syntax before deploying. |
create | Deploy the template. |
what-if | Preview changes without applying. |
show | Inspect a deployment. |