Open mdekrey opened 6 years ago
I've just run into this issue as well. It's come up for us as we deploying the function into a docker container that's running on a Linux App Service plan and as such the recommendation is the use the double underscore __
to delimit the hierarchy.
I'd be interested in hearing what other people have done here. Our work around is to use a single underscore _
rather than the double underscore __
I can confirm that even using .Net 8 and isolated process the function runtime doesn't translate the settings coming from the App Configuration. It does translate the settings coming from the environment variables.
That contradicts the official guidance - https://learn.microsoft.com/en-gb/azure/azure-functions/functions-app-settings#app-setting-considerations
So for anybody stumbled and looking for quick answers:
:
as a section delimiter--
as a delimiter__
as a delimiterThis approach works both for web and for functions.
I believe there is an inconsistency in configuration variables when running a
netstandard2.0
library. I use hierarchical configuration via Microsoft.Extensions.Configuration, such as:When translated to environment variables, such as provided by the app settings in the azure portal, I can achieve this by using
__
:This gets translated to a
:
in theIConfiguration
object, or I can access by the "Storage" section.For Azure Functions, however, when debugging locally, the
__
in mylocal.settings.json
file does get swapped to a:
. As a result, my QueueTrigger needs to be set toStorage:Processing
for local debugging. When running on the Azure cloud, the__
does not get translated as expected for an environment variable; I must provideStorage__Processing
for production.Investigative information
Please provide the following:
Repro steps
Provide the steps required to reproduce the problem:
__
(two underscores) in it, such asStorage__Processing
.ConnectionStrings
section of the local.settings.json.:
in the C# attribute, such asConnection = "Storage:Processing"
.Storage__Processing
with a type of "Custom" and test.Expected behavior
Provide a description of the expected behavior.
Storage:Processing
to be consistent with the rest of .Net Core's configuration. It could also be both, if you wanted to be resilient.)Actual behavior
Provide a description of the actual behavior observed.
Storage:Processing
runs locally.Storage__Processing
runs in the cloud.Known workarounds
Provide a description of any known workarounds.
Related information
Provide any related information
Edited
Removed information about the "connection strings" name difference. I haven't done enough investigation on that, and it should be a different issue anyway if it is a problem.