Reputation: 361
I have created an app setting name under Application settings as circled in red in the following image (myStorageName).
It does have value. However, whenever I call the following line in my HttpTrigger function, it returns null.
accountName = ConfigurationManager.AppSettings["myStorageName"];
log.LogInformation(accountName);
I tried to include myStorageName under Manage but I don't think ConfigurationManager.AppSettings
is meant to retrieve function keys and host keys under Manage.
Any solution? Thanks.
Upvotes: 0
Views: 333
Reputation: 361
This solved my problem. "myStorageName" should indeed be stored under Application Settings.
accountName = System.Environment.GetEnvironmentVariable["myStorageName"];
log.LogInformation(accountName);
App setting name is not to be confused with function keys and host keys.
There are two types of keys:
- Host keys: These keys are shared by all functions within the function app. When used as an API key, these allow access to any function within the function app.
- Function keys: These keys apply only to the specific functions under which they are defined. When used as an API key, these only allow access to that function.
Upvotes: 2