ARM TEMPLATES – DEPLOYMENT MODES

Incremental Deployment Mode:

  • This is the default deployment mode of the ARM templates.
  • It doesn’t modify or remove any existing Azure resources.
  • Provides support for versioning or rolling back deployments.

Complete Deployment Mode:

  • This deployment mode deletes resources that are not mentioned in the template.
  • It is the best option for when you want to start fresh or when you want to refactor a solution

For example, you have a resource group that contains a resource A. Then, you deploy resources B and D. If you use incremental deployment mode, then after the deployment, the resource group will have resources A, B and D. If you use complete deployment mode, you will have resources B and D in your resource group.

Then, suppose you want to deploy resource E. In incremental deployment mode, your resource group will contain the resources A, B, D and E. But, in complete deployment mode, your resource group will only contain resource E.

Next, let us see this in live action.

First of all, create this new resource group that will contain our deployment modes related resources. Run this cmdlet to create the resource group.

This is the first template we are going to deploy. This template deploys a storage account. You can take a look at the template and study it. Next, we will deploy it using PowerShell ISE.

Run this cmdlet to deploy the Demo2CompletevsIncremental.json template. This cmdlet uses the complete mode and deploys in the resource group that we just created. Also, before starting the deployment process, PowerShell asks for our confirmation since this is the complete mode and any existing resources in the resource group would get deleted.

Once the deployment gets succeeded, you can go and check the Azure portal and you will find the storage account created there.

Now run this cmdlet that deploys the same Azure template but with the incremental deployment mode.

You will not find another storage account. That is because we are deploying the same template so it doesn’t matter which deployment mode we are using, it will not deploy the same resource twice using the same template with all the same details.

Now, we have one more template Demo2CompletevsIncremental2.json that deploys a Virtual Network. Using this template, let us understand the incremental and complete mode a little bit better.

Run this cmdlet that deploys the VNet template with incremental mode.

Once it gets deployed, you will find the VNet in the resource group along with the storage account.

Now deploy the VNet template again. But this time, do it with the complete mode.

Now when the command gets successful and the deployment gets completed, you will find only the VNet in the resource group. Since there was no mention of the storage account in the template, it deleted the existing storage account.

So, this is how the complete and increment deployment modes work in Azure ARM templates.