TL'DR
The Microsoft.Web sites/config 'slotConfigNames' resource has a string array
property called appSettingNames
. ALL slots' settings are scanned and matched against this array. Matches produce sticky settings.
For example:
- Production slot settings:
{ DB: 'prod-db', FOO: 'bar' }
- Staging slot settings:
{ DB: 'stg-db', BAZ: 'qux' }
- SlotConfigNames:
[ 'DB', 'BAZ' ]
- Result:
DB
sticky in prod
and stg
slots, BAZ
sticky in stg
slot
Bicep sample
param location string = resourceGroup().location
resource appServicePlan 'Microsoft.Web/serverfarms@2022-09-01' = {
// omitted for breveity
}
var webAppProperties = {
// omitted for brevity
}
// Deployed to the staging slot, and eventually swapped to the production slot, NOT STICKY!
var webAppSettings = {
DOTNET_ENVIRONMENT: 'Demo'
}
var webAppStickySettings = {
productionSlot: {
DB: 'prod-db'
FOO: 'bar'
}
stagingSlot: {
DB: 'staging-db'
BAZ: 'qux'
}
}
// In this example: [ 'FOO', 'DB', 'BAZ' ]
var webAppStickySettingsKeys = [for setting in items(union(webAppStickySettings.productionSlot, webAppStickySettings.stagingSlot)): setting.key]
resource webApp 'Microsoft.Web/sites@2022-09-01' = {
// Production slot
name: 'sample-webapp'
location: location
properties: webAppProperties
resource appsettings 'config' = { name: 'appsettings', properties: webAppStickySettings.productionSlot /* Only prod slot sticky settings, other settings will arrive after staging slot swap */ }
// Staging slot
resource stagingSlot 'slots' = {
name: 'staging'
location: location
properties: webAppProperties
resource appsettings 'config' = { name: 'appsettings', properties: union(webAppSettings, webAppStickySettings.stagingSlot) }
}
// Sticky settings
// Note: although this resource is a direct child of the webApp's production slot, this config applies to both the production and staging slots
// This config simply matches the appSettingNames of the webApp's production slot AND staging slot
// For all matches, it will mark the appSetting as sticky
resource slotsettings 'config' = {
name: 'slotConfigNames'
properties: {
appSettingNames: webAppStickySettingsKeys // in this example: [ 'FOO', 'DB', 'BAZ' ]
}
}
}
Final Results
Production Slot (Azure Web App Configuration Screenshot)

Staging Slot (Azure Web App Configuration Screenshot)
