Steve Spencer's Blog

Blogging on Azure Stuff

Publishing Windows Azure Websites with TFS

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

Enter the url details and click Create Web Site

image

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

Enter your TFS url (or create a new one), then click Authorize Now.

image

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

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

You have now linked your web site in TFS to the Azure Website. This will take a few moments to synchronise.

image

Your website has not been deployed yet. You need to make a change and then check the changes in

image

upon check-in the build is started

image

image

When the build is complete the new website is deployed

image

image

You can also revert back to older versions of the web site by clicking the desired version and then clicking redeploy:

image

This will start the redeploy of the older version:

image

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

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.

Comments (4) -

  • Preetham Reddy

    6/10/2012 6:26:20 AM | Reply

    This is great... How do we upgrade/downgrade application database when deploying through TFS... Do we have to do it manually?

    Also, Why would you want to take that risk, when you can deploy it through VS?

  • steve

    6/11/2012 7:50:00 AM | Reply

    When deploying through TFS you have access to the CI build that is used to do the deployment. You can edit the build definition to add in extra steps to dpeloy your database for example.

    When using this method to deploy your website this needs to be part of an overal ALM strategy and you generally go through a number of testing stages and deploy out to a variety of servers. Automating the deployment is a good way to minimise risk as you remove the human error parts of the process. You could have a number of builds that are run to deploy to different environments and they could be manually triggered as well as automatic (e.g. CI) or scheduled (e.g. nightly). The builds can also be configured to run some tests. If you are using a branching strategy where the releasable code is "promoted" to different branches then at each stage a build can be kicked off on a different branch triggered by a checkin on the branch.

  • james r

    10/27/2012 12:56:02 AM | Reply

    Our website is not checked in to the root of the TFS collection... it's a large project with soc and different projects for each layer... Can this be point to a specific folder in TFS?

  • steve

    11/8/2012 8:15:17 AM | Reply

    James, You can edit the build definition and change your workspace to point to wherever you want in TFS.

Loading