2 years ago
#50219

DrEichenbach
Bicep template FunctionApp App Key creation
I am deploying Azure Functions using bicep templates. To connect the FunctionApp to my API-Management, I want to have an additional AppKey called management
that is randomly generated. Currently my solution for this looks like that
resource functionKeys 'Microsoft.Web/sites/host/functionKeys@2021-02-01' = {
name: '${functionApp.name}/default/management'
dependsOn: [
functionAppConfig
]
properties: {
name: 'management'
}
}
This worked for some weeks but now I always get the following arbitrary error when deploying the template in my DevOps Pipeline
ERROR: {"status":"Failed","error":{"code":"DeploymentFailed","message":"At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.","details":[{"code":"BadRequest","message":"{\r\n \"Code\": \"BadRequest\",\r\n \"Message\": \"Encountered an error (ServiceUnavailable) from host runtime.\",\r\n \"Target\": null,\r\n \"Details\": [\r\n {\r\n \"Message\": \"Encountered an error (ServiceUnavailable) from host runtime.\"\r\n },\r\n {\r\n \"Code\": \"BadRequest\"\r\n },\r\n {\r\n \"ErrorEntity\": {\r\n \"Code\": \"BadRequest\",\r\n \"Message\": \"Encountered an error (ServiceUnavailable) from host runtime.\"\r\n }\r\n }\r\n ],\r\n \"Innererror\": null\r\n}"}]}}
My API-Management is available and also used by other FunctionApps successfully and the FunctionApp I try to set this key for too. In t he Azure Portal I receive an error with little more information, stating that the failed resource is of type Microsoft.Web/sites/host/functionKeys
. The above mentioned code is the
only occurrence of this type.
Is there any different way to properly set AppKeys for a functionApp from a Bicep template? I found Microsoft.Web/sites/functions/keys@2020-06-01
but that requires a parent of type Microsoft.Web/sites/functions
but I use type Microsoft.Web/sites
for my symbolic name functionApp.
azure
azure-devops
azure-deployment
azure-bicep
0 Answers
Your Answer