When WebJob starts (Program.Main()), configuration item in Azure Application Settings does NOT override the value set in app.config.
Both ConfigurationManager.AppSettings and CloudConfigurationManager.GetSetting return the same value from app.config instead of the override in Azure Application Settings
While once WebJob Function gets registered, settings in Azure become accessible as normal when it's fired
Environment:
VS2017 v15.8.5,
Target framework .NET Framework 4.6,
Microsoft.Azure.WebJobs v2.3.0,
Microsoft.Azure.WebJobs.Core v2.3.0,
Microsoft.Azure.WebJobs.Extensions v2.2.0,
Microsoft.Web.WebJobs.Publish v2.0.0
Microsoft.Azure.ConfigurationManager v4.0.0
1.App.config:
<appSettings>
<add key="EXECUTION_ENVIRONMENT" value="PleaseSpecify" />
</appSettings>
2.Azure Application Settings:
APP SETTING NAME VALUE
EXECUTION_ENVIRONMENT UAT
3.Program.cs:
class Program
{
static void Main(string[] args)
{
// return "PleaseSpecify" instead of "UAT" in Azure
var ee1 = ConfigurationManager.AppSettings["EXECUTION_ENVIRONMENT"];
Console.WriteLine(ee1);
// return "PleaseSpecify" instead of "UAT" in Azure
var ee2 =
Microsoft.Azure.CloudConfigurationManager.GetSetting("EXECUTION_ENVIRONMENT");
Console.WriteLine(ee2);
}
}
4.Publish to Azure through Visual Studio...
5.Check WebJob logs will see the problem as commented in the source above
I would hope settings in Azure take precedence over those in App.config but they're not!
Any thoughts are much appreciated!