Garima
Garima

Reputation: 441

How to deploy Azure webapp to multiple environments without using config transforms

I have a multi-tier Azure web app which uses EF DB first model. I want to deploy it in dev, test, staging and production environment. Each environment has different database connection string as well as different ida:PostLogoutRedirectUri url. Is there any way I can skip using web config transform and just use app settings to manage deployment to multiple environments.

I am able to use connection string from app settings in Azure portal. But not sure how to configure PostLogoutRedirectUri in app settings and use that value in web.config.

Upvotes: 0

Views: 960

Answers (1)

rickvdbosch
rickvdbosch

Reputation: 15621

But not sure how to configure PostLogoutRedirectUri in app settings and use that value in web.config

The following is true for all settings in a .NET application in an Azure App Service:

App settings
This section contains name/value pairs that your app will load on start up.

  • For .NET apps, these settings are injected into your .NET configuration AppSettings at runtime, overriding existing settings.

Source: Configure apps in Azure App Service

Simply put, this means:
- if a setting is only in web.config, your app will use the value from your config file
- if a setting is also under App Settings, it will override the value in the config

So put the base/default value in your config, and override it in App Settings when necessary.

EDIT:
You should not look at the config to check if the value has been substituted there. The file is NOT transformed or altered, the values are injected at runtime. Otherwise, changing a setting under App Settings would mean an app recycle (since it would change the web.config file).

Upvotes: 1

Related Questions