Link Search Menu Expand Document

ARM Cheat Sheet

ARM Template Creation

Via Azure Portal

Start creating any resource you want to have a template of proceed until ‘Review + Create’ but do not continue from there. Instead choose ‘Download’ to download a template file.

ARM Template Specs

az group create --name <resource group for specs> --location <location>
az ts create \
  --name <spec name> \
  --version "1.0" \
  --resource-group <resource group> \
  --location <location> \
  --template-file <spec file>

and to deploy a resource from an existing spec

id=$(az ts show --name storageSpec --resource-group <resource group> --version "1.0" --query "id")
az deployment group create \
  --resource-group <resource group> \
  --template-spec $id \
  [--parameters <param>=<value>]

ARM Template Validation

  • arm-ttk: Template validation
  • ARM What-If Validation

      $Parameters = @{
        ResourcegroupName    = "ARMDeploymentTest"
        Templatefile         = ".\StorageAccount\azuredeploy.json"
        TemplateParameterfile = ".\StorageAccount\azuredeploy.parameters.json"
        Mode                 = 'Incremental'
      $Result = Get-AzResourceGroupDeploymentWhatIfResult @Parameters


      az deployment group what-if -g <group> -f <template file> -p <parameters>
  • Pester: Template deployment validation