Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ARM Deployment: Get Azure Function API Key

As part of a Stream Analytics deployment solution I want to retrieve the API key for a Azure Function App in an ARM template via e.g. the listkeys() function. Is there a way to retrieve this key via an ARM template respectively during an ARM deployment and if yes, how?

Thanks

like image 888
quervernetzt Avatar asked Dec 24 '22 03:12

quervernetzt


1 Answers

The new Key Management API of Azure Functions has gone live. Its possible via the following ARM Script. Also check this Github issue

"variables": {
    "functionAppId": "[concat(parameters('functionAppResourceGroup'),'/providers/Microsoft.Web/sites/', parameters('functionAppName'))]"
},
"resources": [
    {
        "type": "Microsoft.KeyVault/vaults/secrets",
        "name": "[concat(parameters('keyVaultName'),'/', parameters('functionAppName'))]",
        "apiVersion": "2015-06-01",
        "properties": {
        "contentType": "text/plain",
        "value": "[listkeys(concat(variables('functionAppId'), '/host/default/'),'2016-08-01').functionKeys.default]"
        },
        "dependsOn": []
    }
]
like image 66
Dibran Avatar answered Dec 28 '22 11:12

Dibran