Hello Jon Bell
During a swap, the first step is to apply production settings to the staging slot and warm it up. This means that there is a period of time during which both the production slot and the staging slot run the app with production settings - which could be problem
In order to detect whether my app is running in the staging slot with production settings you can check the WEBSITE_HOSTNAME
environment variable. Before the swap this has the value of xxxx.azurewebsites.net
on the production slot and xxxx-staging1.azurewebsites.net
on the staging slot.
After the swap is complete, WEBSITE_HOSTNAME
will have the value of xxxx-staging1.azurewebsite.net
in both slots - so it is impossible to detect when the swap is done using this variable.
Setting the value of WEBSITE_HOSTNAME
is important because it is used for application insights telemetry to derive the cloud_RoleName
property.
https://stackoverflow.com/questions/75684758/azure-deployment-slot-swap-both-slots-use-production-settings
https://github.com/microsoft/azure-pipelines-tasks/issues/19273