Modifying the host.json file for a Function App using Bicep? #8518
-
Hi, I'm trying to modify the contents of the host.json file for a Function App that I'm deploying manually using a Bicep template. I'm trying to remove the routePrefix from the app which defaults to /api/ . It is possible to get the results I want by manually editing host.json and editing extensions.http.routePrefix to have an empty value, but I can't figure out how I would write this into a Bicep template. Any guidance would be appreciated. {
"extensions": {
"http": {
"routePrefix": ""
}
}
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I dont think you can modify the host.json file using ARM or bicep since it's part of you code deployment. However, you can override individual values in host.json with appsettings. This is described here: https://learn.microsoft.com/en-us/azure/azure-functions/functions-host-json#override-hostjson-values You can either set appsettings as part of your sites-resource, like they do here: https://learn.microsoft.com/en-us/azure/azure-functions/functions-create-first-function-bicep?tabs=CLI Or you can deploy appsettings using a child resource like I do here: https://github.com/SimonWahlin/TwitchLiveNotifications_Template/blob/main/templates/modules/functionApp-appSettings.bicep Remember that you cannot modify a single setting using bicep, you have to deploy them all every time. |
Beta Was this translation helpful? Give feedback.
I dont think you can modify the host.json file using ARM or bicep since it's part of you code deployment.
However, you can override individual values in host.json with appsettings. This is described here: https://learn.microsoft.com/en-us/azure/azure-functions/functions-host-json#override-hostjson-values
You can either set appsettings as part of your sites-resource, like they do here: https://learn.microsoft.com/en-us/azure/azure-functions/functions-create-first-function-bicep?tabs=CLI
Or you can deploy appsettings using a child resource like I do here: https://github.com/SimonWahlin/TwitchLiveNotifications_Template/blob/main/templates/modules/functionApp-appSettings.bicep
Remember that y…