Search code examples
asp.netazureasp.net-coreazure-web-app-servicesecret-manager

ASP.NET 5 SecretManager Production Values for Azure


I'm just using the SecretManager in ASP.NET 5 and don't quite understand how I'm meant to set these values for production / staging environments on Azure website.

Is there a user interface somewhere, do I just add them as AppSettings in the Azure portal, or do I need to use the Kudu Debug Console to set them?

Thanks

Matt


Solution

  • If you look at the code that configures UserSecrets -

            if (env.IsDevelopment())
            {
                builder.AddUserSecrets();
            }
    
            builder.AddEnvironmentVariables();
            Configuration = builder.Build();
    

    It simply adds the UserSecrets to the collection of environment variables whenever the environment is development.

    So yes you need to add those secrets as standard App Settings when you deploy to Azure.