DevTools Logo

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
SectionPurpose
$schemaTemplate schema URL.
contentVersionTemplate version string.
parametersUser-supplied inputs.
variablesReusable computed values.
resourcesAzure resources to deploy (required).
outputsValues returned after deployment.

Template functions

Table
FunctionPurpose
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
CommandPurpose
validateCheck syntax before deploying.
createDeploy the template.
what-ifPreview changes without applying.
showInspect a deployment.

References