Importance of app settings in azure website portal


If you login to your azure portal (https://manage.windowsazure.com/) and go to your website dashboard and then to configure you can see the “app settings” section.

Many people do assume that you can edit your websites web.config values from here. However it is not the case. Even if you add the new values here it wont affect the existing values in your web.config; neither updating the web.config will changes the values you see on the azure dashboard.

Lets try with simple page.

See below the screen shot from azure portal

1. Go to the configure section of your website

image

2. Scroll down to app settings

image

As show above add some key and value. I have added MyName and value as “Patil”

3. Save the changes by clicking save button a the bottom.

4. Open Visual Studio and Create new Website.

5. Open web.config and add following app setting in it

<appSettings>

       <add key="MyName"   value="Subodh" />

</appSettings>

5. Add test page and make it to display value of app settings key by reading from configuration manager.

E.g. I am display it on label on my page

 Label1.Text = WebConfigurationManager.AppSettings["MyName"];

6. Run the project and you should see the output as “Subodh”. The value is read from web.config.

7. Now publish the website to azure portal and run the website. You should see the different value as you added in the azure portal app settings section.

You can find working demo of the same at http://subodhdemo1.azurewebsites.net/AppSettingsAzure.aspx

 

How do I get benefited with this feature ?

Suppose you are working on a project where you are storing some sensitive information in app settings of your web.config. You have many developers who are working on this project and you don't wan to expose it to them.

However you also don't want to edit the web.config every time you publish from Visual Studio.

Nobody other than the user with portal credentials will have access to your azure portal.

This also benefits you in the way that no more you need to store your data as clear text in web.config

This way you secure your web.config data from azure portal.

Comments (1)

  1. GetCloudy says:

    There is not much information provided in the blog. Also I did not see what I should be getting out of this post by reading the content.

Skip to main content