Home > other >  how to add function app keys to logicapp app settings through bicep
how to add function app keys to logicapp app settings through bicep

Time:06-01

I am creating logic app and function app through bicep configuration but need to update logicapp app settings with function app master key.

below is the bicep template

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?'
        }
        ...
      ]
      ...
    }
    ...
  }
}

could someone help me how to add function app master key to logic app settings. thanks in advance

CodePudding user response:

You can get the master key using the listKeys function:

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

In you case, you could write something like that:

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

  • Related