At some point you’re going to want to add an object to the Values section of local.settings.json. Don’t! Declaring an object (or array) in the Values breaks the configuration, resulting in Missing value for AzureWebJobsStorage in local.settings.json. Notice the customObj declaration below.
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "UseDevelopmentStorage=true",
"AzureWebJobsDashboard": "UseDevelopmentStorage=true",
"customKey": "customValue",
"customObj": {
"customObjKey": "customObjValue"
}
}
}
Just having customObj declared will breaks things. Yes, it’s valid JSON; no, your functions won’t be able to retrieve settings from Value.
A simple key-value pair works – like customKey above. After removing customObj, retrieving the setting for customKey from Values is straight-forward
var customVal = System.Environment.GetEnvironmentVariable("customKey");
Beyond this simple case for local.settings.json, use app configs, and remember that Azure Functions v2 switched to ASP.NET Core Configuration, and does not support ConfigurationManager. See Jon Gallant’s post for details.
You must log in to post a comment.