Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Converting keys in appsettings.json to Azure Portal App Settings

My appsettings.json file looks like this:

{
   "sqlDatabase": {
      "name": "my-sql-db",
      "connectionString": "my-connection-string-for-my-sql-db"
   },
   "documentDatabase": {
      "name": "my-document-db",
      "connectionString": "my-connection-string-for-my-document-db"
   }
}

What keys do I use when enter these settings into "App Settings" under Settings > Environment Variables on Azure Portal?

For example I tried using sqlDatabase:name as the key for my SQL Database name but : is not allowed in key names. How do "convert" my keys to what Azure Portal would accept?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I’m trying to do this for my Azure Functions app but I’ll also need it for my API that runs on Azure App Service.

>Solution :

As per Configuration keys and values:

In environment variables, a colon separator may not work on all platforms. A double underscore, __, is supported by all platforms and is automatically converted into a colon :

So try sqlDatabase__nameinstead of sqlDatabase:name

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading