You can source configuration from environment variables by calling .AddEnvironmentVariables()
on you ConfigurationBuilder
.
It will load environment variables prefixed with APPSETTING_
It will then use colon :
as the key path separator.
This means that : following environement settings :
APPSETTING_Security:Authentication:UserName = a_user_name
APPSETTING_Security:Authentication:Password = a_user_password
Will be the equivalent this json :
{
"Security" : {
"Authentication" : {
"UserName" : "a_user_name",
"Password" : "a_user_password"
}
}
}
** Note that Azure Service will transmit settings as environment variables. Prefix will be set for you transparently. So to do the same in Azure just set two Application Settings in AppSettings blade :
Security:Authentication:UserName a_user_name
Security:Authentication:Password a_user_password