Tips for Using Visual Studio Team Services in Your Projects

Tips for Using Visual Studio Team Services in Your Projects
Photo by Josh Sorenson / Unsplash

Coordinating development efforts and source code across individuals and teams is usually filled with its own set of challenges. Thankfully, if you are working on a side project of any kind, Microsoft has a very generous and free offer for you: Visual Studio Team Services. This is a fully managed, cloud hosted solution by Microsoft that is free for a team of up to five individuals. In fact, I have blogged a bit about it before but recently I have been involved in a fun side project with some friends, and we started trying out VSTS to streamline our development efforts. So I thought I would share a few tips that I have collected in that last few years while using Visual Studio Team Services (VSTS) and Git.

VSTS loves Git

The popularity of Git has skyrocketed in the last few years, if you want some statistics on that fact then check out the links for this answer on Stack Exchange. The massive adoption of Git has also caused source code repository providers like GitHub to experience high growth, so much so that even competing service providers eventually gave up and shut down their service. (R.I.P. CodePlex). So as you know or may suspect, VSTS supports Git as a first class citizen. In fact, when creating a new project in VSTS the default source code repository provider is Git:

VSTS Project Homepage

The image above shows how simple it is to start a new project in VSTS, select your Version control (Git) and Work item process (Agile) and go!

Hosting your code

Once your project is created for the first time, you will get an introductory screen with instructions on how to clone your new empty repository, or if you already have a repository then you can follow the instructions on uploading it to VSTS. Also, you can do import a repository from another provider like GitHub. In essence, the choices for getting started with VSTS are quite flexible:

VSTS Project Startup Guidance

In my case, I already have a sample Hello World! sample console application that I will go ahead and push to my new project repository using the helpful commands taken from the VSTS initial project page:

Git Push Command To VSTS

Authenticating to VSTS

So perhaps you already tried pushing out your existing code to VSTS and you received an authentication error. Or maybe you were trying to connect to an existing repository that one of your friends shared with you and you were halted on your progress because, yet again, you encountered some authentication errors. There are numerous reasons why your authentication efforts may have failed such as permissions issues or the like, so instead of enumerating a long list of reasons why this could happen, I will simply give you a few tips on how you can enhance your chances of diminishing authentication errors with VSTS and make the whole process more seamless.

Git For Windows

If you recall from the first screen shown on VSTS after first creating your project, that is, the screen with all of the instructions for uploading your code to VSTS and importing your code and the like. Well, there is a mention of Git for Windows, which already comes bundled with the Git Credential Manager for Windows (GCMW). The latter is an open source tool that "provides secure Git credential storage for Windows" as mentioned in its GitHub project page. If you install Git for Windows then you can enable this feature during the installation wizard:

Get Git for Windows

Git Credential Manager for Windows

So if you have a project that is hosted on VSTS, then all you have to do to work with your project is clone your repository using your Microsoft credentials and then the GCMW will automatically cache and encrypt your credentials on the OS. This is the simplest and easiest way to work with Git on VSTS from a Windows environment.

Authenticating to VSTS with Tokens

If you are working on an environment other than Windows, or if you are having issues connecting or cloning a Git project hosted in VSTS, then you can make use of VSTS security tokens in order to authenticate to VSTS via the command line.
A security token can be setup for your VSTS projects by navigating to the Security section which can be found under your profile section dropdown on the top right of the VSTS page:

Profile - Security Navigation Link

Once you are on that page, you can manage all your tokens or Add new ones:

List of Tokens

Once you Add a new token you will then be asked to give it a duration. The default is 90 days, but you can increase that up to 1 year if desired.

New Token Creation

Once you generate your token you will have to keep it in a secure place, because once it is generated and displayed you will not be able to go back and see it again.

Visual Studio Plugins

In addition, if you are using Visual Studio 2017 with either VSTS or GitHub, then you should definitely get familiar with the Git tooling integrated into Visual Studio. I won't go into detail about the tooling but if you are interested you can find more information on getting started here: Also, if you are using GitHub as your source code repository along with Visual Studio, then you will definitely want to check out the GitHub Extension for Visual Studio

Visual Studio Code & Git

Lastly, if you are a fan (like myself) of Visual Studio Code (VS Code), then you already know that VS Code is tightly integrated with Git. However, if you are new to VS Code and want to know more information on how to work with VS Code and Git then checkout their excellent documentation:

For the love of Git!

So as you can see VSTS is a pretty cool offering, and the fact that it is highly integrated with Git is a big plus in my book...oh yeah, and it is free for small teams. What is there not to like?

So hopefully this has been helpful in giving you a few ideas on how to reduce the friction in your process flow and increase your productivity when using Git in VSTS.

Until next time, happy coding.