I have the following bicep file that adds deployment slots with config settings:
var appSettings = [
{
name: 'WEBSITE_RUN_FROM_PACKAGE'
value: 1
}
{
name: 'WEBSITE_ENABLE_SYNC_UPDATE_SITE'
value: 1
}
]
var stagingSettings = [
{
name: 'AzureWebJobs.StarterFunction.Disabled'
value: 1
}
]
var productionSettings = [
{
name: 'AzureWebJobs.StarterFunction.Disabled'
value: 0
}
]
module functionAppTemplate 'functionApp.bicep' = {
name: 'functionAppTemplate'
params: {
name: '${functionAppName}'
kind: functionAppKind
location: location
servicePlanName: servicePlanName
secretSettings: union(appSettings, productionSettings)
}
dependsOn: [
servicePlanTemplate
]
}
module functionAppSlotTemplate 'functionAppSlot.bicep' = {
name: 'functionAppSlotTemplate'
params: {
name: '${functionAppName}/staging'
kind: functionAppKind
location: location
servicePlanName: servicePlanName
secretSettings: union(appSettings, stagingSettings)
}
dependsOn: [
functionAppTemplate
]
}
functionApp.bicep:
resource functionApp 'Microsoft.Web/sites@2018-02-01' = {
name: name
location: location
kind: kind
properties: {
serverFarmId: resourceId('Microsoft.Web/serverfarms', servicePlanName)
clientAffinityEnabled: false
httpsOnly: true
siteConfig: {
use32BitWorkerProcess : false
appSettings: secretSettings
}
}
identity: {
type: 'SystemAssigned'
}
}
resource functionAppSlotConfig 'Microsoft.Web/sites/config@2021-03-01' = {
name: 'slotConfigNames'
parent: functionApp
properties: {
appSettingNames: [
'AzureWebJobs.StarterFunction.Disabled'
]
}
}
functionAppSlot.bicep
resource functionAppSlot 'Microsoft.Web/sites/slots@2018-11-01' = {
name: name
kind: kind
location: location
properties: {
clientAffinityEnabled: true
enabled: true
httpsOnly: true
serverFarmId: resourceId('Microsoft.Web/serverfarms', servicePlanName)
siteConfig: {
use32BitWorkerProcess : false
appSettings: secretSettings
}
}
identity: {
type: 'SystemAssigned'
}
}
I want this setting 'AzureWebJobs.StarterFunction.Disabled' only for staging slot (NOT for production slot) and stick that setting to staging slot. How would I update this code?
For each of your application settings you can add
"slotSetting": true
This will only enable it for the slot in question