如何通过二头肌将应用程序配置设置粘贴到暂存槽

问题描述 投票:0回答:2

如何通过二头肌将应用程序配置设置粘贴到插槽?

这是我的二头肌文件:

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'
  }
}

部署此代码时,我没有看到应用程序配置设置固定在插槽中:

复选框未选中。我错过了什么?

azure azure-functions azure-resource-manager azure-bicep azure-deployment-slots
2个回答
4
投票

您需要创建一个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'
    ]
  }
}

-1
投票

目前无法通过 bicep 进行暂存槽,只能用于生产槽。您可以通过 YAML、门户或 CLI 更新配置设置暂存槽。

© www.soinside.com 2019 - 2024. All rights reserved.