Gal Dreiman
Gal Dreiman

Reputation: 4009

How to use configuration file for Azure web app

I want to deploy an app on Azure Web App engine and I encountered a problem: My app is depended on outside configuration file, which contains DB access keys and some other configuration keys I don't want to save hard-coded.

Anyway, I thought to use configuration service like Spring with Git or some other similar services to handle the configuration but all of the solutions I found were heavy.

I bet I'm not the first one who struggle with this. So What is the common way to use out configuration file with Web-App?

Upvotes: 0

Views: 728

Answers (1)

Naresh Podishetty
Naresh Podishetty

Reputation: 797

you can have any of the below ways to maintain application settings or connection strings.

  1. directly use from web.config. All the app settings and connection strings would be hard coded in configuration file and publish the same to Azure Web App. this is not recommended to store secrets/connection strings
  2. you can use Application Settings provided by App Service from the portal enter image description here these settings will override keys provided in Web.Config file. you can have connection strings and secrets updated here instead of web.config to avoid direct exposure to end developer.

  3. you can have all you secrets and connection strings in Azure Key Vault and refer to them from web application as URI(REST) for this, you need to register your web app with Azure AD. this is highly recommended way for production web sites.

UPDATE Incorporated this answer into my blog post here

Upvotes: 1

Related Questions