Continuous Deployment with TFS Service and Windows Azure
Continuous Integration, Continuous Deployment and Delivery are very hot topics in any discussion nowadays regarding development teams.
Continuous Integration or CI (quoting Martin Fowler): “Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily - leading to multiple integrations per day. Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible. Many teams find that this approach leads to significantly reduced integration problems and allows a team to develop cohesive software more rapidly. This article is a quick overview of Continuous Integration summarizing the technique and its current usage”
Continuous Deployment or CD: IC + Automating Deployment to any Staging Environment using a Deployment Pipeline.
Continuous Delivery: CD + Ops & Business Commitment and extensive automation.
Automation is key for this kind of practices and of course Team Foundation Build System is out of the box prepared for all this scenarios.
In this post I am going to walk over a native Azure solution to demo a Continuous Deployment scenario. This solution integrates with TFS Service (Cloud version of TFS) in order to pull changes and deploy versions on a Website.
Let’s create a Website called demovs2012 in our Azure Subscription. This process takes seconds. After the website is created, you can configure a source control system associated with it:
Good news is that there are several supported systems to choose from:
Let’s select TFS Service and associate our Team Project with it. You will need to authorize Azure to get versions from your Team Project:
After authorizing Azure to connect to your TFS Service, select the source Team Project where you manage the Website source code:
The latter process will create a Build Definition in your project automatically (notice the CD as in Continuous Deployment):
The created Build Definition is disabled by default. Enable it to start deploying automatically to Azure!
Also notice that this Build is a full CI Build, as Unit Tests are being executed, Static Code Analysis being enforced if configured, etc.
The cool part is that you can do a regression in the same way. Just go to the Deployments section in your Website panel, and check out the history:
Select one previous deployment and click Redeploy option in the bottom bar. This will redeploy from previous version.
Enjoy!