ARM deployment fails when using WEBSITE_RUN_FROM_PACKAGE and listkey function
See original GitHub issueI have an Azure ARM template that deploys two Azure Functions to an Azure App Service Premium Plan (EP1). The templates add the default host key of the first function to the app settings of the first function using the listkey
function:
"FunctionOneKey": "[listkeys(concat(variables('functionOneppId'), '/host/default/'),'2016-08-01').functionKeys.default]"
If I deploy this template to a new resource group, it works the first time (at least most of the time). Every subsequent deployment fails with a Bad Request Error:
{
"Code": "BadRequest",
"Message": "Encountered an error (ServiceUnavailable) from host runtime.",
"Target": null,
"Details": [
{
"Message": "Encountered an error (ServiceUnavailable) from host runtime."
},
{
"Code": "BadRequest"
},
{
"ErrorEntity": {
"Code": "BadRequest",
"Message": "Encountered an error (ServiceUnavailable) from host runtime."
}
}
],
"Innererror": null
}
The reason for the ServiceUnavailable error is probably because Kudu adds a web.config with a rewrite rule (because I use WEBSITE_RUN_FROM_PACKAGE but don’t have deployed the function).
Investigative information
Please provide the following:
- Function App version: 3.0 / 2.0
- Region: Tested with North Europe, Germany West Central
Repro steps
The templates is available here.
You can reproduce this issue by deploying this template at least two times:
New-AzResourceGroupDeployment -ResourceGroupName 'my-resource-group' -TemplateFile "c:\Path\to\azuredeploy.json" -name "azuredeploy-$(New-Guid)"
Expected behavior
I should be able to run the ARM deployment multiple times without an error.
Known workarounds
The deployment works if I disable WEBSITE_RUN_FROM_PACKAGE.
Related information
I posted a related question on StackOverflow.
Issue Analytics
- State:
- Created 4 years ago
- Comments:31 (11 by maintainers)
Same issue here, I cannot use listkeys, and I get the same error message, which really does not say anything meaning- or helpful.
My template is deploying an EventGrid Topic and some EventTopic Subscribers, I only reference the Function App to get the key, in order to use it for the Subscribers. The Function App, however is Run From package, since C# code is deployed to it in an earlier stage.
@ alI am closing this thread since there are too many different issues being conflated and it is very difficult to see what needs to be investigated / what is failing.
Please open a new (separate) issue and feel free to @ me and I will follow up individually.