I'm using appsettings.json for the configuration of my Azure Function (netcoreapp3.1, running on a Windows machine).
In the appsettings.json file there is a array with settings:
{
"ArraySettings": [
{
"ArraySettingProperty1": "ArraySetting1Value1",
"ArraySettingProperty2": "ArraySetting1Property2"
},
{
"ArraySettingProperty1": "ArraySetting2Value1",
"ArraySettingProperty2": "ArraySetting2Property2"
}
],
"SingleSetting": "SingleValue"
}
It works fine if I run the Azure Function locally. But it seems not to work on Azure although the appsettings.json file was deployt and can be found by the Azure Function.
In Startup.cs:
private IConfiguration InitializeConfiguration(IFunctionsHostBuilder functionsHostBuilder)
{
ExecutionContextOptions executionContextOptions = functionsHostBuilder
.Services
.BuildServiceProvider()
.GetService<IOptions<ExecutionContextOptions>>()
.Value;
return new ConfigurationBuilder()
.SetBasePath(executionContextOptions.AppDirectory)
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddEnvironmentVariables()
.Build();
}
This is what I already tried (without success):
Copying the settings to the
Valuessection of thelocal.settings.jsonfileAdding the settings to the Application Settings on Azure (with and without commenting out the
appsettings.jsonconfig) in the following key formats:2.1 ArraySettings:ArraySettingProperty1:0
2.2 ArraySettings__ArraySettingsProperty1__0
2.3 Values__ArraySettings__ArraySettingsProperty1__0
Why do the array settings work locally but not on Azure? How can I make them work on Azure? Thanks!