One of the conundrums we have with deploying sites to test means that there is often a lot of configuration that is needed on a test site that is different to a live site. There is also the time and risk of deploying a new instance into the production sites once testing has completed.
Azure websites has introduced deployments slots which allows you to have multiple deployments and swap between them in a similar way you could do with the production and staging slots in cloud services. Websites has the added advantage that you can have more than two slots and you can call them whatever you want.
One approach we are looking at to ensure consistency with what is deployed is to configure up a number of slots on the website for a variety of uses e.g. Production, Staging, UAT. The issue with having multiple slots is that there are often sets of configurations that are required to ensure that each slot will work with the correct backend. By default all configuration stored in the appsettings in web.config will move with the slot. Details of the exact configuration settings that move with the deployment can be found here (http://azure.microsoft.com/en-gb/documentation/articles/web-sites-staged-publishing/)
For example, in my web.config file I have the following setting
<add key=”about” value=”This is the web.config text” />
This setting can be overridden in the Azure portal(s) and these by default will follow the deployment and not stay with the slot.
So in this example the “about” config will be set to “This is Now the Staging slot” and when the staging slot is swapped to be production, the new production configuration will also be “This is Now the Staging slot”
This is not necessarily what you want on production. Websites has a feature, that is currently unsupported by the management portal(s), which allows specific configuration items to become sticky i.e. they stay with the slot. There is a powershell cmdlet which allows individual appsettings to be marked as sticky and remain with the slot regardless of the deployment that is in the slot and they will also remain in the slot when the slots are swapped.
This can be set for both Appsettings and connection strings by running the following commands
Set-AzureWebsite -Name somesite -SlotStickyAppSettingNames @(“about”, “another_config_key”)
Set-AzureWebsite -Name somesite -SlotStickyConnectionStringNames @(“a_connection_string”, “some_other_connectionstring”)
After running the commands the example above will still have the configuration setting above, but once the deployment is swapped from the staging slot to production the configuration will remain on the staging slot.
This approach should now allow us to deploy to a UAT slot with UAT configuration and allow the customer to test, when they are happy we can move the same deployment that has just been tested to the staging slot with production configuration and be tested in isolation to live to ensure that it works. When you are happy that the staging slot is working this can then be swapped out to production.
For a more detailed introduction to slots and configuration see: