Azure Resource Manager Templates Deployment Mode - Incremental

ARM allows us to deploy the ARM template in the following modes:

  1. Incremental
  2. Complete

In this article, we will learn how an “Increment” mode behaves while deploying the ARM template to Azure.
In my previous articles (listed below), we discussed how to create and deploy the Azure ARM templates using Visual Studio.

  1. Azure App Service: Create Web Apps Using Resource Manager Template In Visual Studio

If you have observed the output window, while the deployment is going on in Visual Studio, you might have noticed that there is an attribute named “Mode” with the value “Incremental” which is the default deployment mode that is considered by ARM.



Let’s have a small discussion on different scenarios on how the “Incremental” behaves based on the resources that we configure in the ARM template.

Note: Please create a new project using a Blank ARM template, as described in the article Basics of Azure Resource Manage Template.

Open the template file as shown below:



Below is the screen capture of my Azure’s All Resources. It’s currently empty.



Let’s now create the following resources.

  1. A New App Service Plan
  2. A New App Service Web App

Open JSON Outline Window, right click on “resources” and select “Add New Resource”.



It created a new resource “armappserviceplan” in the resource section as shown below:



Again, Open JSON Outline Window, right click on “resources” and select “Add New Resource” .



(Please note that the App Service plan is not yet created in Azure)

Now, select “Web App” and provide a meaningful name for the Web App and click on “Add” as shown in the window, above.

Visual Studio will create another entry in the resource section as shown below:



Let’s have an overview of few use cases and review the output, when you deploy the template in an Incremental mode.

  1. Add new Resource(s) to the template that doesn’t exist in Azure– We just authored two new resources to our ARM template file. Let’s deploy them. Right click on the project, select “Deploy” -> “New Deployment”.



    Clicking on the “New Deployment” in the step shown above will open up the following Window.



    Select the Resource Group, where you want to deploy the new resources. If you don’t have any Resource groups yet, please create one.

    Before clicking on “Deploy” button, click on “Edit Parameters” to provide a name for the App Service Plan.



    Click “Save”, as shown above .

    Now click on “Deploy” button in the “Deploy a Resource Group” Window. Visual Studio will now create the two resources as shown below:

    Conclusion 1: If a template has a resource say “NewService1” which doesn’t exist in the Azure resource group, then the new resource “NewService1” is created when the template is deployed.

    *NewService1

  2. Try to re-deploy an existing resource.

    1. Let’s change a small property (I have changed the framework to 3.5 from 4.6) of the App Service Web App that we just created as shown below and click on “Save” to save the change.



    2. Let’s redeploy the same template as shown below:



    3. The template is successfully deployed as shown below.



    Now, go to Application settings of the App Service Web App to see if the .NET Framework version.



    It remained 3.5, even after re-deploying the template file. Hence, if we re-deploy the ARM template in an incremental model, it wouldn’t change the existing resources.

    Conclusion 2: If a template has a resource say “Service1” which is already there in Azure resource group, then the resource “Service1” will remain unchanged in the Azure resource group.

  3. Remove an existing resource from the template which is already there in Azure – Now, let’s remove an existing resource from the template and re-deploy. For the sake of simplicity, let’s remove the App Service – Web App, redeploy and see what happens to the App Service in Azure.

    In the JSON Outline window, right click on the app service that we created and select “delete”, as shown below:



    Now, deploy the ARM template.



    Now, let’s open Azure Management Portal and see if there are any changes or not.



    Yes, there are no changes to the App Service in the Azure portal, though we deleted the resource from the template file. This is because the default mode is an “Incremental”.

    Conclusion 3:
    Though we deleted the resource from the template and reapplied it, it didn’t delete the same resource in the Azure Resource Group because the mode is an incremental.

Hope, you now understand how an “Incremental” mode works. Please let me know if you have any questions / feedback.

Up Next
    Ebook Download
    View all
    Learn
    View all