Tallan Blog

Tallan’s Experts Share Their Knowledge on Technology, Trends and Solutions to Business Challenges

Continuous Integration with TFS and Azure Cloud Services

Microsoft provides a useful tutorial (located here) for running a TFS Continuous Delivery configuration, and automatically publishing to Azure. This tutorial, while instructive, is somewhat out of date, and it may be useful to have a more personalized experience of building such a continuous deployment, while running through the instructions on the tutorial.

As may be the case for others, the TFS server used for running automated builds was already setup and configured, and the project to be built already linked to this server, so I won’t go into that here. The build server is running TFS 2013, and the ASP.NET MVC5 application being built and deployed is running on Visual Studio 2013.

After verifying the functionality of the build server, I created a package build in TFS Team Build. These configuration settings are for the most part self-explanatory, but the exact configuration in the Process page required a little more work:


  • For adding MSBuild arguments, not only was it necessary to include the two arguments related to publishing (these are what actually generate the .cspkg and .cscfg files, required to publish to Azure), I also needed to add the argument /p:BuildServer=True.
  • I found it necessary to manually specify the exact Build Agent being used by the TFS Server, along with any tags that this agent uses (in my case, the build agent has the “WindowsPhone” and “WindowsStore” tags).
  • Mileage will vary with the other configuration settings, and where the TFS build server is configured to place builds, but I had no trouble working with the build server that was provided to me.

In Step 4, a PowerShell script is used to automate the process of deploying to Azure. The parameters used in the script must be specified, but you likely won’t have to change the ones that have defaults specified already (except perhaps for $environment, but unless you know you’re deploying to a Production server in Azure, leave it as-is). Additionally, the PublishCloudService.ps1 file has one out of date command:

Set-AzureSubscription -CurrentStorageAccount $storageAccountName -SubscriptionName $selectedsubscription

I replaced it with the following two commands:

Set-AzureSubscription -CurrentStorageAccountName $storageAccountName -SubscriptionName $selectedsubscription

Select-AzureSubscription -SubscriptionName $selectedsubscription

Which fixed my issues. Additionally, I highly recommend specifying parameters manually within the file first, before proceeding on, to verify that everything works as advertised. Particularly, make sure your .cspkg and .cscfg files are being correctly generated and referenced, and that the required .publishsettings file (generated from the Azure account in question) is being used.

Finally, following the instructions in Step 5 for modifying the default build template XAML file did not  immediately work as advertised. As is outlined in this post, TFS 2013 deprecates the built-in variables for Workspace, among others, so using it as directed no longer works. Instead, I replaced the ConvertWorkspaceItems in items 4 and 5 with GetLocalPath items:


Which works like a charm.

Learn more about Tallan or see us in person at one of our many Events!

Share this post:

2 Comments. Leave new

Hey Stephen Kimble
This post is awesome !!! Could you please provide me this customized TFS template , It would be very helpful for me?


Stephen Kimble
January 30, 2015 1:08 pm


I would recommend following the steps outlined in Step 5 of the configuration procedure, and getting further information about configuring the .xaml file from the default template there (https://msdn.microsoft.com/library/dd647551.aspx); but for reference, I have shared the xaml file I created at the link below.


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>