_From @jimt4593 on January 18, 2017 6:44_
Right now, the only way to read appsettings, stored is apsettings.json, is from the environment. My Azure Function uses assemblies that user ConfigurationManager.AppSettings to read app setting values. These assemblies are also used by Azure web apps and web apps that still run on web servers running on premise.
I do not want to have to update these assemblies to access app settings in 2 ways. Using ConfigurationManager. AppSettings first. Then, if not found, using Envirorment.GetEnviromentVariable. I'd like to requst that ConfigurationManager.Appsettings be updated to read values from the application.json file.
_Copied from original issue: Azure/Azure-Functions#149_
Is there any indication when this is available for use?
@mkamonster It will be in the 0.10 release, which will be out within a few days. We'll create a new "release" on the releases page.
Thanks for the feedback Donna! In that case we will use a small workaround for the remaining days.
Wow, that's nice. It's already released. It works like a charm. For the people wondering on where to put settings in appsettings.json. Make use of the Values property for your keys.
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "",
"AzureWebJobsDashboard": "",
"Message": "Hello world!"
}
}
You can in this case access the message via:
ConfigurationManager.AppSettings["Message"]
@mkamonster Thanks for providing the example! As you can see, our documentation is lagging behind our releases at the moment. :) I'll make sure to add this example to the documentation work item.
How do I get the update? Do I just download WebToolsAzure2015.exe (from https://aka.ms/azfunctiontools) again?
At the moment of running I got the message if I wanted to upgrade the cli. I did. But because it's a npm package I think updating it via npm should work as well.
actually VS doesn't use the npm package. VS has it's own logic to check for updates and download the latest tooling. It happens once per VS session though (as far as I know), so you'd have to kill all VS instances and then launch it. When you try to run any functions projects you'll get notified to upgrade.
If you're using the cli through npm, then you just need to update it there npm i -g azure-functions-cli
When you try to run any functions projects you'll get notified to upgrade.
Thanks. I was prompted as you described.
Most helpful comment
Wow, that's nice. It's already released. It works like a charm. For the people wondering on where to put settings in appsettings.json. Make use of the Values property for your keys.
You can in this case access the message via: