What is the standard structure to add keys to appsettings.json
?
Also, how to read those values in our run.csx
?
Normally in app.config, we had Con
To load the environment or appsettings value you need to use the
System.Environment.GetEnvironmentVariable property
public static void Run(TimerInfo myTimer, TraceWriter log)
{
log.Info($"C# Timer trigger function executed at: {DateTime.Now}");
log.Info(GetEnvironmentVariable("AzureWebJobsStorage"));
log.Info(GetEnvironmentVariable("WEBSITE_SITE_NAME"));
}
public static string GetEnvironmentVariable(string name)
{
return name + ": " +
System.Environment.GetEnvironmentVariable(name, EnvironmentVariableTarget.Process);
}
Manage app settings variables - https://docs.microsoft.com/en-us/azure/azure-functions/functions-how-to-use-azure-function-app-settings