We have an .NET core app hosted in azure. Some of the configurations from appsettings.json are overridden in azure under app service / configuration / application settings
.
This works fine for "flat" properties, but not for arrays (of flat values), which is explicitly documented by microsoft here (also referenced in this answer).
For example, for the following section from the appsettings:
"Config": {
"SomeProperty": "Some string value",
"SomeArray": [
"Apple",
"Banana",
"Orange"
]
}
Setting Config:SomeProperty = new string
correctly changes the property thus environment variables seem to be set correctly in general.
I would like to override the entire array Config:SomeArray
in the azure appsettings.
None of the following options changes anything about the array value at runtime:
Key | Value |
---|---|
Config:SomeArray | ['NewValue'] |
Config:SomeArray | ["NewValue"] |
Config:SomeArray:0 | NewValue |
The last option comes from multiple answers around the web (e.g. here) which state that one could'nt override a whole array (of subobjects) but only element-wise.
Am I doing something wrong or is it possible to change array properties over azure application settings? If not (or if only elementwise, somehow), is there any better option than changing it to a string property and parsing the array manually (the only alternative I see right now, which people obviously (and rightfully) dislike) ?