Azure Resource Manager deployment modes

When deploying your resources, you specify that the deployment is either an incremental update or a complete update. The primary difference between these two modes is how Resource Manager handles existing resources in the resource group that aren't in the template. The default mode is incremental.

For both modes, Resource Manager tries to create all resources specified in the template. If the resource already exists in the resource group and its settings are unchanged, no operation is taken for that resource. If you change the property values for a resource, the resource is updated with those new values. If you try to update the location or type of an existing resource, the deployment fails with an error. Instead, deploy a new resource with the location or type that you need.

Complete mode

In complete mode, Resource Manager deletes resources that exist in the resource group but aren't specified in the template. Resources that are specified in the template, but not deployed because a condition evaluates to false, aren't deleted.

There are some difference in how resource types handle complete mode deletions. Parent resources are automatically deleted when not in a template that's deployed in complete mode. Some child resources aren't automatically deleted when not in the template. However, these child resource are deleted if the parent resource is deleted.

For example, if your resource group contains a DNS zone (Microsoft.Network/dnsZones resource type) and a CNAME record (Microsoft.Network/dnsZones/CNAME resource type), the DNS zone is the parent resource for the CNAME record. If you deploy with complete mode and don't include the DNS zone in your template, the DNS zone and the CNAME record are both deleted. If include the DNS zone in your template but don’t include the CNAME record, the CNAME isn't deleted.

For a list of how resource types handle deletion, see Deletion of Azure resources for complete mode deployments.

Note

Only root-level templates support the complete deployment mode. For linked or nested templates, you must use incremental mode.

Incremental mode

In incremental mode, Resource Manager leaves unchanged resources that exist in the resource group but aren't specified in the template. When redeploying a resource in incremental mode, specify all property values for the resource, not just the ones you're updating. If you don't specify certain properties, Resource Manager interprets the update as overwriting those values.

Example result

To illustrate the difference between incremental and complete modes, consider the following scenario.

Resource Group contains:

  • Resource A
  • Resource B
  • Resource C

Template contains:

  • Resource A
  • Resource B
  • Resource D

When deployed in incremental mode, the resource group has:

  • Resource A
  • Resource B
  • Resource C
  • Resource D

When deployed in complete mode, Resource C is deleted. The resource group has:

  • Resource A
  • Resource B
  • Resource D

Set deployment mode

To set the deployment mode when deploying with PowerShell, use the Mode parameter.

New-AzResourceGroupDeployment `
  -Mode Complete `
  -Name ExampleDeployment `
  -ResourceGroupName ExampleResourceGroup `
  -TemplateFile c:\MyTemplates\storage.json

To set the deployment mode when deploying with Azure CLI, use the mode parameter.

az group deployment create \
  --name ExampleDeployment \
  --mode Complete \
  --resource-group ExampleGroup \
  --template-file storage.json \
  --parameters storageAccountType=Standard_GRS

The following example shows a linked template set to incremental deployment mode:

"resources": [
  {
      "apiVersion": "2017-05-10",
      "name": "linkedTemplate",
      "type": "Microsoft.Resources/deployments",
      "properties": {
          "mode": "Incremental",
          <nested-template-or-external-template>
      }
  }
]

Next steps