如何通过 Bicep 将功能应用程序按键添加到逻辑应用程序设置

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

我正在通过 Bicep 配置创建逻辑应用程序和函数应用程序,但需要使用函数应用程序主密钥更新逻辑应用程序设置。

以下是二头肌模板:

resource funcapp 'Microsoft.Web/sites@2021-01-15' = {
  name: funcappname
  location: Location
  tags: tags
  kind: 'functionapp'
  properties: {
    enabled: true
    serverFarmId: spfuncapp.id
    ...
  }
}

resource logicappsite 'Microsoft.Web/sites@2021-01-15' = {
  name: logicapp
  location: Location
  tags: tags
  kind: 'functionapp,workflowapp'
  properties: {
    enabled: true
    serverFarmId: spD365LogicApp.id
    siteConfig: {
      appSettings: [
        {
          'name': 'azureFunctionOperation_functionAppKey'
          'value': '<function app master key here?'
        }
        ...
      ]
      ...
    }
    ...
  }
}

如何将功能应用主密钥添加到逻辑应用设置?

azure azure-functions azure-logic-apps azure-resource-manager azure-bicep
1个回答
2
投票

您可以使用

listKeys
功能获取主密钥:

listKeys(resourceId('Microsoft.Web/sites/host', funcappname, 'default'), '2022-03-01').masterKey

在你的情况下,你可以写这样的东西:

appSettings = [
  {
    'name': 'azureFunctionOperation_functionAppKey'
    'value': listKeys(resourceId('Microsoft.Web/sites/host', funcapp.name, 'default'), '2022-03-01').masterKey
  }
]

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