Search code examples
asp.net-core-3.1azure-keyvaultappsettingsazure-app-configuration

appsettings.json copied, passed or published to Azure App Service configuration?


I have been trying to understand the appsettings.json method of use for some time now as I am building an ASP.NET Core 3.1 API that is to be published to Azure.

When I'm publishing the project to my web app my settings don't seem to get copied to the App Service configurations list in the Azure App Service resource.

Is this how it is supposed to work or am I missing something here?

I've read about appconfigurationbuilder and such, but as I understand it it's for telling the application which appsettings.json file to use depending on what environment is defined in the environment variable (ASPNETCORE_ENVIRONMENT) for example.

Though having a bunch of Key Vault references in my config, this doesn't work as my references of type:

@Microsoft.Keyvault(SecretUri=[KEY VAULT SECRET URL])

Can't fetch the secret from keyvault by only being the the appsettings.env.json file and not being copied to the app service configurations where they connect to keyvault through identity principal.

What am I missing or have I misunderstood the whole thing with appsettings.json?

So short recap: what I'm trying to do is understand if app settings can work like this:

appSettings.Env.json --> publish project to Azure app service --> settings are set automatically in app service configuration.

Solution

  • As mentioned in the comment, the app settings will not be copied to the azure app service when published, you need to specify the values in it manually.

    Follow this doc - https://learn.microsoft.com/en-us/aspnet/core/fundamentals/environments?view=aspnetcore-5.0#azure-app-service