ARM template deployment resets tags for function app

Ankur Deswal 0 Reputation points
2024-04-29T16:17:14.5433333+00:00

I first deployed an Azure function app using ARM templates, the ARM template includes a couple of tags as well.

Now I want to add new app-settings to the Function-App, Adding those through ARM template deployment is causing my 'Tags' to be deleted,

Need help in figuring out why the Tags are being deleted, Attached the ARM templates to replicate the issue.

Func-ARM.txt

app-setting-ARM.txt

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,366 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Luis Arias 5,131 Reputation points
    2024-04-29T19:57:17.0133333+00:00

    Hi Ankur Deswal,

    First I would advise you to check the ARM deployment modes Complete and Incremental:

    https://learn.microsoft.com/en-us/azure/azure-resource-manager/templates/deployment-modes

    If you deploy an ARM template with tags and then deploy the same ARM template with app settings for a web app but without specifying the tags, the tags from the first deployment will be deleted. This is because of the Incremental deployment mode behavior in Azure Resource Manager (ARM).

    In Incremental mode, if a resource already exists in the resource group and its settings are unchanged, no operation is taken for that resource. However, if the property values for a resource are changed, the resource is updated with those new values. So, if you deploy the same ARM template without the tags, it would be considered a change in the property values of the resource, and the tags would be removed.

    To avoid this, you should include all the properties that you don’t want to change in your ARM template. In your case, you should include the tags in your ARM template when you add the app settings for the web app. This way, the tags will not be removed when you deploy the ARM template.

    Remember, Complete mode behaves differently. In this mode, Resource Manager deletes resources that exist in the resource group but aren’t specified in the template. So, if you were to use Complete mode and didn’t specify the tags in your ARM template, all resources not specified in the template (including the tags) would be deleted.

    If the information helped address your question, please Accept the answer.

    Luis

    0 comments No comments