Consider this appsettings.json
:
{
"Parent": {
"ChildOne": "C1 from secrets.json",
"ChildTwo": "C2 from secrets.json"
}
}
According to Microsoft (https://blogs.msdn.microsoft.com/waws/2018/06/12/asp-net-core-settings-for-azure-app-service/), if an app using this config was deployed to an AppService in Azure, the config could be overwritten by creating Application settings in Azure in the style Parent:ChildOne
/ Parent:ChildTwo
. To be clear: using colons to target a specific piece of config.
This works just fine with a standard AppService:
However, if you're using Web App for Containers / i.e. a Docker image deployed to an Azure App Service on Linux (https://learn.microsoft.com/en-us/azure/app-service/containers/app-service-linux-intro) you cannot use colons:
Why?
When you hover over the error you see this message: This field can only contain letters, numbers (0-9), periods ("."), and underscores ("_")
. Using .
does not work alas.
How do you configure say Parent:ChildOne
in Azure? Parent.ChildOne
does not work. Can anyone advise? I can't find any docs on this....
After more experimentation than I'd like to admit I think I have the answer.
Where you use :
on an App Service, use a __
(double underscore) on an App Service with containers.
So Parent__ChildOne
instead of Parent:ChildOne
.
To read a little more (not much more), I wrote this up as a blog post here: https://blog.johnnyreilly.com/2018/07/28/azure-app-service-web-app-containers-asp-net-nested-configuration/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With