I use the secrets.json file to store credentials for my Blazor .Net Core 3.0 Web App and use IConfiguration to get the values like this
public Startup(IConfiguration configuration)
{
Configuration = configuration;
var username = Configuration["Account:Username"];
var password = Configuration["Account:Password"];
new Account(username, password);
}
public IConfiguration Configuration { get; }
Which works fine on my machine in Development, but when I switch to Release in my app Properties > Debug > Environment variables > ASPNETCORE_ENVIRONMENT, the secrets.json doesn't get loaded. Same when I upload the app to Azure, where I have set up the variables as Application settings, it doesn't work. What am I missing here? How can I set up the Web App in Production on Azure, so that I can use the credentials?
edit:
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});