This is a follow on post from my introduction to Windows Azure Websites and shows you how you can synchronise your website in TFS with Windows Azure.
One of the biggest problems with the way you deploy applications to Windows Azure is that minor changes (e.g .markup, content and styling) require a redeploy to publish the changes. Windows Azure Websites solves this problem by allowing you to synchronise your website with Team Foundation Server or GIT.
In this post I will show you how easy it is to manage your websites in version controlled environment using Team Foundation Service. Team Foundation Service is a cloud hosted version of Team Foundation Server.
This works by creating a continuous integration build with your source code that will automatically deploy your website after successful build each time code is checked in.
This is configured as follows:
Click the “+” button at the bottom of your portal screen and select Website –> Quick Create
![image image](http://blogs.blackmarble.co.uk/blogs/sspencer/image.axd?picture=image_thumb_20.png)
Enter the url details and click Create Web Site
![image image](http://blogs.blackmarble.co.uk/blogs/sspencer/image.axd?picture=image_thumb_21.png)
An Empty site has now been created.
This site now needs to be link to your Team Foundation Service. Click on the website in the dash board and then select “Setup TFS Publishing”. you will also note that you can use a GIT repository as well as TFS.
![image image](http://blogs.blackmarble.co.uk/blogs/sspencer/image.axd?picture=image_thumb_22.png)
Enter your TFS url (or create a new one), then click Authorize Now.
![image image](http://blogs.blackmarble.co.uk/blogs/sspencer/image.axd?picture=image_thumb_23.png)
this connects through to your TFS service and setup the CI build that will deploy your application to the cloud.
The TFS site will now be displayed asking you to authorize the connection
![image image](http://blogs.blackmarble.co.uk/blogs/sspencer/image.axd?picture=image_thumb_24.png)
You now need to pick the website you want to deploy. If you haven’t create a site yet then you need to go to ~Visual Studio, create your site and check it in to TFS.
![image image](http://blogs.blackmarble.co.uk/blogs/sspencer/image.axd?picture=image_thumb_25.png)
You have now linked your web site in TFS to the Azure Website. This will take a few moments to synchronise.
![image image](http://blogs.blackmarble.co.uk/blogs/sspencer/image.axd?picture=image_thumb_26.png)
Your website has not been deployed yet. You need to make a change and then check the changes in
![image image](http://blogs.blackmarble.co.uk/blogs/sspencer/image.axd?picture=image_thumb_27.png)
upon check-in the build is started
![image image](http://blogs.blackmarble.co.uk/blogs/sspencer/image.axd?picture=image_thumb_28.png)
![image image](http://blogs.blackmarble.co.uk/blogs/sspencer/image.axd?picture=image_thumb_29.png)
When the build is complete the new website is deployed
![image image](http://blogs.blackmarble.co.uk/blogs/sspencer/image.axd?picture=image_thumb_30.png)
![image image](http://blogs.blackmarble.co.uk/blogs/sspencer/image.axd?picture=image_thumb_31.png)
You can also revert back to older versions of the web site by clicking the desired version and then clicking redeploy:
![image image](http://blogs.blackmarble.co.uk/blogs/sspencer/image.axd?picture=image_thumb_32.png)
This will start the redeploy of the older version:
![image image](http://blogs.blackmarble.co.uk/blogs/sspencer/image.axd?picture=image_thumb_33.png)
A new build is kicked off using the same changeset details as the original deployment. Once the build is complete the web site is reverted back. this whole cycle only took a few minutes so it is a lot faster than the redeploy mechanism you had previously.
![image image](http://blogs.blackmarble.co.uk/blogs/sspencer/image.axd?picture=image_thumb_34.png)
![image image](http://blogs.blackmarble.co.uk/blogs/sspencer/image.axd?picture=image_thumb_35.png)
TFS and Windows Azure provide a good mechanism for version controlling your website. Adding application life cycle management to any software development activity is a good thing.