Reputation: 195
I was trying to access my web.config values in Azure Function, but then I came to know that we have to add config values in appsettings.json.
I made those changes and uploaded appsettings.json at azure function location but no luck. my azure function is not reading the values kept in json file.
Please suggest way forward.
Upvotes: 2
Views: 3041
Reputation: 24569
The file local.settings.json stores app settings, connection strings, and settings for Azure Functions Core Tools. It has the following structure:
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "<connection string>",
"AzureWebJobsDashboard": "<connection string>"
},
"Host": {
"LocalHttpPort": 7071,
"CORS": "*"
},
"ConnectionStrings": {
"SQLConnectionString": "Value"
}
}
We could get more info about Local settings file from this document.
These settings can also be read in your code as environment variables. In C#, use System.Environment.GetEnvironmentVariable or ConfigurationManager.AppSettings. In JavaScript, use process.env. Settings specified as a system environment variable take precedence over values in the local.settings.json file.
Upvotes: 1
Reputation: 35154
You should configure your Function App via Application settings
menu item, see example.
appsettings.json
or other config files are ignored.
Upvotes: 0