My lucky day! Azure functions! Setting up a simple azure function comes with some settings that are located in the local.settings.json. I wanted to read some settings inside the local.settings.json…how can we do this?
This is how your local.settings.json should look like in your azure function app:
{"IsEncrypted": false, "Values": { "AzureWebJobsStorage": "UseDevelopmentStorage=true", "FUNCTIONS_WORKER_RUNTIME": "dotnet"
"MyKey": "Test" }}
If you want to read “MyKey” simply use the Environment class:
Environment.GetEnvironmentVariable("MyKey")
That’s it! Enjoy!