Configuring Visual Studio Code extension Azure Repos

Azure Repos and Visual Studio are a great combination. VS Code Extension Azure Repos is not perfect, but it simplifies development a lot. It has a bad rating in the Visual Studio marketplace, especially due to the unclear configuration process. But configuration is quite easy, if you use the following guideline.

To use the two products you need:

  1. Current version of Visual Studio Code
  2. A git based Azure DevOps Repo
  3. Visual Studio Code extension Azure Repos
  4. tf.exe (so Azure Repos extension can use the Visual Studio version commands)

1, 2 and 3 are easy. To get tf.exe you can install Visual Studio Community Edition. You do not need any workloads, just the minimal version (about 600 MB). If you already have Visual Studio instaledl, you do need to install the Community Edition, of course.

Please copy the path to the file tf.exe, because you need to configure the path in Visual Studio Code settings.Using Visual Studio Community Edition tf.exe might be here (status June 2019): C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\tf.exe

Go to your Azure DevOps Repo. Go to Repos/Files. Press "Clone" on top right.

Select a folder. Please note: Below this folder the local repository will be added. 

Log in with your Azure DevOps account. Click "Open local repository" or "Add to workspace". 

Execute git config --global user.email ".." and git config --global user.name "...", if not already done.

Now open VS Code command palette. 

Enter “team signin":

Click “current experience”:

Go to your Azure Repo. Click on your account on top right and select "Security".

Create a token using “Full access”. From a security perspective this is not perfect, but it seems to be necessary.

Copy the token to the clipboard.

Enter the Azure Repo token in VS Code:

Press enter.

Now you see 3 icons in the bottom status line:

1/ Name of the branch

2/ Wheel with two arrows to check in your code

3/ Name of your repository. Click on the repository and you will be forwarded to your Azure Repo. You will use this link often later on to get immediate access to Azure Repo without logging in explicitly via browser.

That’s it! Enjoy VS Code and Azure DevOps Repo.