In this article we are going to see how to automatically Build and Deploy the latest code check in’s from the Team Foundation Services over the cloud to Windows Azure Environment. Here before we step forward I suggest the readers to have a look at the article on “Configuring Team Foundation Service (TFS) for Windows Azure Website or Cloud Services – #Meet Azure Edition” which provides the steps on how to setup a Team Foundation Services with Windows Azure environment. We will make use of the same application (F5debugonCloud) which we used in our earlier article, and configure it to make an automatic build to upload to the Azure Environment easily. [more]
Open Visual Studio 2012 and navigate to the solution explorer to open the project (F5debugoncloud), once all the files are listed navigate to the team Explorer and we can see the Build available as shown in the screen below.
Now just double click on the build name to get the complete details about the build i.e. when the build is executed, how long it took to execute, and complete summary of the build as shown in the screen below.
Right click on the Build Definition from the Team Explorer and select Edit Build Definition as shown in the screen below. Here we are going to edit the build definition to make a continuous delivery of the build to the Azure environment.
Clicking on Edit Build Definition, will open a windows where navigate to the Triggers menu and select the option Continuous build integration as shown in the screen below.
Now navigate to the Process tab and we can see the window takes some time to load the Process template (AzureContinousDeployment11.xaml) which is a mandatory file that is used for deployment. We need to check if the Deployment Settings Name is pointing to the correct Azure Deployment project name as shown in the screen below.
Now we are all set, make some code changes and check in the latest code to the Team Foundation Services and we can see the Build ready automically which specifies the detailed information as shown in the screen below.
We can see the deployment happened to the Azure environment for the F5debugonCloud project by navigating to the Deployments section in the Dashboard and see the list of deployments with the time frame as shown in the screen below.
Just click on Browse at the bottom and we can see the changes affected as highlighted in the screen below. (Compare with the existing version from my previous article to see the changes).
Finally once after deployment if we are not satisfied with our build that is deployed and if we want to go back to the previous version, its very simple we have a redeploy option at the bottom as shown in the screen below. Just click on it then the existing build will be redeployed.
Once we selected the build and selected the option Redeploy we can see the build gets redeployed as shown in the screen below. The deployment takes some time to complete we can either make the difference with the time frame which is been added to the deployment name or with the deployment time itself as per the requirement.
After successful build deployment completion we can see the active deployment pointing to the latest deployment as shown in the screen below.
Once the build is redeployed we can see the changes reverted back as shown in the screen below.
That’s it we have done the setup, so each and every time the build is generated the deployment will be taken place automatically without any manual interaction to the azure environment.