Whats new in Windows Azure SDK 1.5 - Local and Cloud Configuration setup for your Windows Azure Application
When you create a new application with Windows Azure SDK 1.5, you will see two separate Service Configuraiton files as below:
- ServiceConfiguration.Local.cscfg
- Use this file for local configuration which can be used for debugging your application in Compute Emulator
- ServiceConfiguration.Cloud.cscfg
- Use this configuration file to set your application for Windows Azure Cloud Deployment
You can open the Role Property Dialog to select which configuration you would want to change as below:
Once you have set the Service Configuration you can provide any desired setting. For example here in my local setting I am using Development Storage:
Following for the Cloud Configuration I am setting Windows Azure Storage credential to be used:
After saving the configuration settings I can verify the changes by opening the configuration file.
Let’s open ServiceConfiguration.Local.cscfg and you can see we are using Development Storage:
<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration serviceName="WindowsAzureProject1" xmlns="https://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="1" osVersion="*">
<Role name="TestWebRoleMVC3">
<Instances count="1" />
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
</ConfigurationSettings>
</Role>
</ServiceConfiguration>
Let’s open ServiceConfiguration.Local.cscfg and you can see we are using Windows Azure Storage account:
<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration serviceName="WindowsAzureProject1" xmlns="https://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="1" osVersion="*">
<Role name="TestWebRoleMVC3">
<Instances count="1" />
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="DefaultEndpointsProtocol=https;AccountName=teststorage;AccountKey=*************************************************==" />
</ConfigurationSettings>
</Role>
</ServiceConfiguration>
Comments
Anonymous
September 19, 2011
Good improvement. But.. wasn't it possible to implement it by using existing build configurations instead? ServiceConfiguration.Debug.cscfg ServiceConfiguration.Release.cscfgAnonymous
September 19, 2011
..also why not to use the same xml transformation mechanism as with Web.config? ServiceConfiguration.cscf + ServiceConfiguration.Release.cscfgAnonymous
September 20, 2011
Thanks Konstantin, Very good comment. I do agree with your point that even if i have one configuration file I can create multiple configuration just by copying them and then edit accordingly to my need. It was possible even before SDK 1.5 but then you will have to create new configuration by copying it, but not everyone knew about it. Having Local and Cloud configuration added through template is just a way to make multiple configurations visible.. Thanks again!!