Coder Perfect

Using Bicep, output the newly formed function app key.

Problem

In a dedicated module, I have a bicep template that builds a function app. I’d like the function app key removed from the module. Is there a way to get the function key?

I can’t seem to find it in the property list:

Asked by Rob Bowman

Solution #1

If you want to get the default host key, use the listkeys function:

param functionAppName string

resource functionApp 'Microsoft.Web/sites@2018-11-01' = {
  name: functionAppName
  ...
}

output defaultHostKey string = listkeys('${functionApp.id}/host/default', '2016-08-01').functionKeys.default

Answered by Thomas

Post is based on https://stackoverflow.com/questions/69251430/output-newly-created-function-app-key-using-bicep