7 YEARS AGO

How to setup Continuous Deployment using VSTS within minutes

Since last year I have become quite a fan of Visual Studio Online a.k.a. Visual Studio Team Services (VSTS). In this post I want to show you how easy you can leverage the VSTS platform and get your continuous deployment pipeline running within minutes.

Explore the VSTS platform

The first thing to do is getting access to Visual Studio Team Services. If you need to convince your team to use it, know that you can get free access to discover the platform. Simply pick a name and create your name.visualstudio.com account.

Tip: please ensure you select the right region for hosting the projects. By default "Central US" will be selected.

Cool thing about VSTS is that you can choose Git (or Team Foundation Version Control) to manage your code!

Create the team project

Next we need to create a team project that will act as placeholder for the code and facilitate the build and release pipelines. If you are planning to do some team development, this is also the place where you select how the team will work with tasks (work items) on the board. You can select the Agile, Scrum or CMMI template. For more info check the processes page, to find the best fit for your team.

Tip: VSTS allows you to preview and work with features that are still being evaluated. You can enable them by clicking your profile picture in the top right corner --> Preview features.

Preview features in VSTS

Push your code

Once the team project is created, VSTS informs you how you can get started with the project. In case of Git, simply clone the repo to your local computer or directly to Visual Studio.

Clone to your computer
In this example, I will use my blog which is developed using Kentico. Simply add the code to the Git repository.

Automate the build process

There are two things important in this step:
  1. We want to ensure that newly added code will build succesfully
  2. We want this done automatically after each check-in
Let's create a new build definition for this to ensure proper handling of our development workflow. The great thing about VSTS is that it offers build templates out-the-box, offering exactly the steps we need:

1) Get sources from the Git repo --> 2) restore the necessary NuGet packages --> 3) build and test the solution --> 4) publish the result (artifact)

Build definition

Tip: new preview versions (if available) of build process tasks are marked with a flag and can be tried out.

preview-task.PNG


The automation part can be easily achieved by adding a trigger. Simply enable Continuous Integration, to automatically start a build whenever a change has been made to the repository.

Continuous Deployment FTW

The final step to a fully automated release pipeline is achieved by creating a new release definition. Similar to the build definitions, VSTS offers release definition templates. In my project I chose to deploy my Kentico blog to an Azure App Service using the Azure App Service Deployment definition.

Create release definition

Just make sure to check the box next to Continuous deployment. This will automatically release the build package whenever a build successfully completes. Finally configure the Azure subscription and you are done!

Tip: for more tips on deployment automation, check out one of my earlier blog posts.

Conclusion

If you've read this far, I hope that you are just as excited as I am regarding the capabilities of the VSTS platform. In my opinion Azure and VSTS is a winning combination!