Search code examples
azureweb-configstaging

Azure development cloud service and live cloud service


For a large web app I want to be able to have a private development cloud service that can be used for internal testing as well as the live cloud service.

They will both work against their own databases. I'll also be using the staging environment for the live environment to utilise VIP swapping..

My question is: What is the easiest way to publish to the development environment OR the live environment without having to manually change connection strings in web.configs? Is there some clever way to transform a config file based on the AzureService configuration?


Solution

  • First, instead of putting connection strings in web.config may I suggest putting them in Service Configuration (.cscfg) file. That way if needed you can dynamically change that setting through portal or programmatically without having to redeploy the application.

    Assuming you have put this setting in service configuration file, there are many ways to accomplish this:

    1. Having separate configuration for each environment: Take a look at this link - http://msdn.microsoft.com/en-us/library/windowsazure/hh369934.aspx where they talk about having one specific configuration scheme for each environment. You could have a dev, qa and production configuration and deploy the application appropriately.
    2. Take a look at this blog post here from Paraleap (makers of popular AzureWatch application): http://blog.paraleap.com/post/2011/09/13/Managing-environments-in-a-distributed-Azure-or-other-cloud-based-NET-solution.
    3. For the applications we are building, we have taken an entirely different approach. We actually have separate cloud projects for each of our environment. Since currently the role size resides in service definition file (.csdef), because we use separate cloud projects for each of our environment we get the flexibility of specifying different sizes for a role based on the environment e.g. we could specify that our test environment will make use of Small VM where as our production environment make use of Large VM.