如何通过二头肌将应用程序配置设置粘贴到插槽?
这是我的二头肌文件:
var stagingSettings = [
{
name: 'AzureFunctionsJobHost__extensions__durableTask__hubName'
value: 'staging'
slotSetting: true
}
]
resource functionApp '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: stagingSettings
}
}
identity: {
type: 'SystemAssigned'
}
}
部署此代码时,我没有看到应用程序配置设置固定在插槽中:
复选框未选中。我错过了什么?
您需要创建一个slotConfigNames资源:
连接字符串、应用程序设置和外部 Azure 存储帐户配置的名称 标识符被标记为粘在部署槽上并且在交换操作期间不会移动。 这对应用程序中的所有部署槽都有效。
类似的东西应该有效:
param functionAppName string
resource functionApp 'Microsoft.Web/sites@2018-11-01' existing = {
name: functionAppName
}
resource functionApps 'Microsoft.Web/sites/config@2021-03-01' = {
name: 'slotConfigNames'
parent: functionApp
properties: {
// Sticky app settings
appSettingNames: [
'AzureFunctionsJobHost__extensions__durableTask__hubName'
]
}
}