Azure slot swap - Do both slots have same "sticky settings" during warmup?

101 Views Asked by At

My understanding of Microsoft's documentation on what happens during a swap, is that if there are slot specific settings, they are applied to the source slot and source is restarted.

If this is the case, does this mean that there is a brief moment where both source and target are running with the same target specific settings?

I have a C# application that reads messages from an Azure Service Bus and the connection to that resource is slot specific (I do not want my staging slot to ever consumer production messages). During the swap, it's possible both source and target will consume messages from my production Azure Service Bus, correct? Is it possible to get around this?

I tried creating a proof of concept to check for this but it's very difficult to understand what is happening to the settings during a swap.

1

There are 1 best solutions below

0
Pavan On

To prevent the production messages going into staging environment by giving the servicebus connection string seperately to staging and production environments in launchsettings.json file.

To give the connection strings for the different environments in local like below:

// appsettings.production.json
{
  "AzureServiceBusConnectionString": "your_production_connection_string"
}
// appsettings.staging.json
{
  "AzureServiceBusConnectionString": "your_staging_connection_string"
}
  • when swapping is doing add the app setting WEBSITE_OVERRIDE_PRESERVE_DEFAULT_STICKY_SLOT_SETTINGS set to0 or false. check this

In the slot-specific settings configuration panel, locate the setting for the Azure Service Bus connection string. Enter the appropriate connection string for the destination slot. make sure you have provide the correct connection string to prevent production messages from being consumed in the staging environment.

enter image description here

Plan slot swaps during periods of low traffic or scheduled maintenance windows to minimize the impact on users and reduce the likelihood of simultaneous execution of both slots.

Slot specific settings adding like below:

enter image description here

The production and staging environments should be specified separately in the local setup with a Service Bus connection string. Please refer to this SO LINK.