我有以下二头肌文件,它添加了带有配置设置的部署槽:
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'
}
}
我希望此设置“AzureWebJobs.StarterFunction.Disabled”仅用于暂存槽(不适用于生产槽),并将该设置粘贴到暂存槽。我将如何更新此代码?
最佳答案
不可能使用二头肌将设置粘贴到暂存槽。您需要将设置粘贴到您的生产插槽中。
您需要使用'Microsoft.Web/sites/config@2022-03-01'
resource appServiceStickySetting 'Microsoft.Web/sites/config@2022-03-01' = {
name: 'slotConfigNames'
parent: appService // <-- This needs to be a /sites resource (reference error below)
properties: {
appSettingNames: [
"Setting Name Here"
]
}
}
关于azure-functions - 将设置粘贴到暂存槽,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72147208/