28 December 2011

Working with ServiceConfiguration file in Azure Cloud

Recently I have been working heavily on CRM2011 + Azure platform, just want to share some of the quick tips for those plan to move their application into Cloud!
You will notice some extra file in your VS2010 solution when you added the Azure web role project, 2 configuration files included which differentiate by the "Cloud" & "Local". It give us the flexibility to deploy our solution base on different environment. For example my case I'm using different DB.


In order to configure the values, right click properties brings us into the setting page that allows developer to add the key into different configuration files.

Always remember to select the service configuration that you want to use base on your deployment. To retrieve the value dynamically on run time after deployment, refer below:
Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetConfigurationSettingValue("SQLConnection")

No comments:

Post a Comment