And now, the moment we’ve all been waiting for. This post will give some insight into the Azure CI build process and how all of this works under the hood. You may be surprised to learn that this solution has very little secret sauce as much as bread and butter. First I want to show a bit of the build template that was included with your TFS project. In a later post, I want to give some information on a new set of activities that may prove useful if you are using TFS online or migrating to an on-premises 2012 instance.
The AzureContinuousDeployment.11.xaml file is the xaml markup defining the build workflow or build template. This file should be located in your TFS project. Open Visual Studio 2012 and connect to TFS online, the file should be at $/<projectName>/BuildProcessTemplates/AzureContinuousDeployment.11.xaml
To open just double click from the source control explorer. If you are using the black theme, switch to the light theme because for some reason the expression text in the workflow designer is black and you cannot see it at all.
At first glance this template looks very similar to a normal default template, but if you dig into the post-compilation area you can find some deployment setup and activities.
The deployment configuration happens at Process > Sequence > Run On Agent > Try Compile, Test…> Sequence > Compile, Test an… > Try Compile and Test > Compile and Test > Sequence > Initialize Variables > If DeploymentEnvironmentName is Set.
There are a couple of new activities here. The activity that manages most of the configuration is named Get Deployment Environment and is part of a new (as far as I can tell) Microsoft.TeamFoundation.Deployment.Workflow assembly.
The result of this sequence is a number of variables set depending on the type of Azure deployment, website or cloud service.
Another new activity is called “Mark this build as including a deployment” under the “Deploy Output” if statement. As far as I can tell this is what adds this build to the Deployment tab.
The next section to note is back up a couple levels under the Compile and Test > Sequence > Deploy Output area.
Under the Publish Output section after the tests have passed you can see the deployment sequences for the Website and Cloud Service.
You can see that if this was an Azure website deploy, the MSDeploy activity is used which simply performs a web deploy. Then afterwards a new activity is used to update the “build number” for the Azure Website. If it is a Cloud Service Deploy then a new activity called DeployAzureCloudApp is used for the deployment.
After that the rest of the build definition is pretty straight forward. With some clever arranging you can see how you can modify this definition to do multiple deployments or even deploy then run tests if you need to.
I hope this gives you a look into the Azure TFS deployments and how it all works. If you have any questions please leave a comment, email me at firstname.lastname@example.org, or contact me on Twitter @tyler_gd.
Thank you as always for reading and I hope you are having a great summer.