web-applicationsenvironment-variablesazure-web-app-serviceappsettings

Azure App Service - Why App Service environment variables doesn't work for virtual directory?


I have two web apps deployed in a single Azure App Service instance:

  1. The first one has a home directory in "site\wwwroot".
  2. The second (api) has a home directory in "site\wwwroot\wwwroot".

I created a new virtual application in the app service - path mappings. I set a name and I set a physical path to:
site\wwwroot\wwwroot

I also set multiple environment variables (App settings) in the app service to override the default ones in the appsettings.json files of the both web apps:

  1. site\wwwroot\appsettings.json
  2. site\wwwroot\wwwroot\appsettings.json

Now the env. variables from the app service are overriding the variables in the first web app (site\wwwroot\appsettings.json). However the override of the variables of the second app (site\wwwroot\wwwroot\appsettings.json) is not working.

Does Azure App Service environment variables also override app. settings from the virtual application or what am I missing here?


Solution

  • Does Azure App Service environment variables also override app. settings from the virtual application

    Yes, you can override app settings of the virtual application using Environment Variables.

    Refer my SOThread to deploy Virtual Applications to single Azure App Service.

    My application folder structure:

    enter image description here

    enter image description here

    enter image description here

    Output:

    enter image description here