Read values from local.settings.json in VS 2017 Azure Function development
Environment.GetEnvironmentVariable("key")
I was able to read values from local.settings.json using the above line of code.
Firstly, I create a sample and do a test with your local.settings.json data, as Mikhail and ahmelsayed said, it works fine.
Besides, as far as I know, Values
collection is expected to be a Dictionary, if it contains any non-string values, it can cause Azure function can not read values from local.settings.json.
My Test:
ConfigurationManager.AppSettings["CustomUrl"]
returns null with the following local.settings.json.
{ "IsEncrypted": false, "Values": { "CustomUrl": "www.google.com", "testkey": { "name": "kname1", "value": "kval1" } }}
Azure function copies the binaries to the bin folder and runs using the azure function cli, so it searches for the local.settings.json, so make sure you have set the "Copy to Output Directory"
to "Copy Always"