ARM Deployment: Get Azure Function API Key
Asked Answered
L

2

5

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

Lectern answered 26/10, 2018 at 13:2 Comment(0)
L
3

This question has already been answered here:

What is important in this context is to set the 'Minimum TLS Version' to '1.0' before deploying the job. Otherwise you will get failures when testing the connection health.

Lectern answered 26/10, 2018 at 13:53 Comment(0)
B
8

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": []
    }
]
Baecher answered 2/7, 2019 at 14:10 Comment(2)
Have anyone succeded in useing this in the same template as the function app is created? I am having issues with host/default not existing.Miscarriage
This is not possible since the function keys are generated when a Http triggered function is deployed inside the function app.Baecher
L
3

This question has already been answered here:

What is important in this context is to set the 'Minimum TLS Version' to '1.0' before deploying the job. Otherwise you will get failures when testing the connection health.

Lectern answered 26/10, 2018 at 13:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.