Why doesn't slot swap bicep template declare the full properties of an app service?

Shunlei Tang 140 Reputation points Microsoft Employee
2024-07-17T14:40:32.8733333+00:00

In slot swap bicep sample, the bicep only declare the buildVersion in staging slot and targetBuildVersion in active slot.

The template is declarative and all the properties need to be included in it. About this sample, why will the missing properties in the sample not get removed when deploy this slot swap bicep template?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,807 questions
{count} votes

Accepted answer
  1. ajkuma 26,216 Reputation points Microsoft Employee
    2024-07-23T11:36:31.02+00:00

    Shunlei Tang, Apologies for the delayed response.

    Based on my understanding of your issue description. The reason the slot swap Bicep template doesn't declare the full properties of an app service is due to the nature of how Bicep and ARM templates work. When you deploy a Bicep template, it only updates the properties that are explicitly defined in the template. Any properties that are not included in the template remain unchanged.

    In the slot swap Bicep sample, the template only declares the buildVersion in the staging slot and targetBuildVersion in the active slot. This means that only these specific properties will be updated during the deployment, and all other properties will remain as they are. The missing properties in the sample will not get removed because the deployment process does not overwrite or remove properties that are not explicitly defined in the template.

    Additionally:

    The slot swap Bicep sample you are referring to is a quickstart template that demonstrates how to swap two deployment slots in an Azure App Service. The sample is intended to be a starting point for creating your own templates and should be modified to meet your specific requirements.

    This ARM template is idempotent, meaning that it can be executed repeatedly and produce the same state of the slots. In other words if you re-run the same template with the same parameters after the swap has been performed and targetBuildVersion on production slot matches the buildVersion then it will not trigger another swap.

    Please checkout these doc for more info:


    If the answer helped (pointed, you in the right direction) > please click Accept Answer to benefit the community find answers quickly to similar question.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.