Configuration Settings in Windows Azure

This week I have had some fun with Windows Azure web and worker roles where I built a polling service to pull data from an external system into Microsoft Dynamics CRM 2011. One of the important factors of the polling service was to include configurable settings such as the time between synchronizations (in minutes) and the connection string to a SQL Azure database. In this post, I will show you how to add and read these configuration settings.

In Visual Studio, expand your Windows Azure project and then click on roles. Right-click on the role you wish to add a configuration setting to and then click on Properties.


Click on the Settings tab and then click on Add Setting. Give the setting a meaningful name and a value. Rebuild the project to save the setting.

Here is an example of how to read the settings inside your code:

string setting = RoleEnvironment.GetConfigurationSettingValue(“sync.time”);

When you upload the package into Windows Azure, you will be able to manage the configuration settings from within Configure area inside the Windows Azure portal. One important thing to note is that the setting values you specify inside the Visual Studio project will act as the default values so if you update any settings inside the portal and then re-upload the package, your settings will get overwritten.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s