How to format nested JSON key structure for app settings in Linux app service?

60 views Asked by At

I'm trying to set up app settings in a Linux app service, but I'm running into an issue. I've noticed that my app setting names that contain periods are being replaced by underscores. I'm also not sure how to handle nested JSON keys like ApplicationInsights:InstrumentationKey. Can someone guide me on how to correctly format these?

1

There are 1 answers

0
Bertus Viljoen On

In Linux app services and custom Linux containers, you need to follow certain conventions for app setting names:

Periods are replaced by underscores: If you have an app setting name containing periods, you'll notice that they are automatically replaced by underscores. For instance, MyApp.The setting should be used as MyApp_Setting in the container.

Nested JSON key structures use double underscores: When you have nested JSON keys, such as ApplicationInsights:InstrumentationKey, the : should be replaced by a double underscore (__). In this case, it should be set as ApplicationInsights__InstrumentationKey in the App Service.

To summarize, always replace periods with underscores and : with __ when you're working with app setting names in a default Linux app service or custom Linux container.

Additional Info: .Net 6 function app not getting values from Azure application settings