VSTS build or release agent on a self hosted machine in Azure or on premise

You can think of many situations where you would like to create a self hosted machine for Visual Studio team services (VSTS). Installing and configuring a self hosted machine requires only a few steps.

Before you begin make sure the system meets the pre-requisites:

  • Windows 10 and Beyond (64-bit): No known system prerequisites at this time.
  • Windows 7 to Windows 8.1, Windows Server 2008 R2 SP1 to Windows Server  : PowerShell 3.0 or higher
  • Visual Studio: Not technically required by the agent, but many build scenarios need Visual Studio.

Besides the system pre-requisites there is also an account pre-requisite:

  • Account with Personal Access Token.

Create a Personal access token

Creating a Personal Access Token (PAT) requires the following steps:

  1. Navigate to the VSTS tenant were you want to add an agent.
  2. In the top bar click on your icon and click on “Security”.

Account options

  1. Within the security window click on Personal Access Token.

Personal Access Token

  1. Click on “Add”  to generate a new personal access token and make sure you select the following scopes:
    • Agent Pools (read, manage)
    • Deployment group (read, manage)

Personal Access Token Creation

  1. Save the generated token.


Install VSTS agent

With all the pre-requisites in place we can start with the agent itself.

  1. Logon to the server that will be the self hosted machine.
  2. Navigate to the VSTS tenant were you want to add an agent.
  3. Go to Setting –> Agent Pools  and click on “Create new Pool”

The pool is a logical container for the agents that you add to VSTS. You can name the pool after the company of define another logical name.


New Pool


  1. Create a folder on the server to install the agent.

It is a good practice to keep the folder naming as short as possible (D:\a or D:\agent).

  1. Download the agent and extract it to the folder you created.

Agent Folder

  1. Open a PowerShell window as administrator and navigate to the created folder.
  2. Run the below command:
  1. During the execution you need to fill in specific information about your tenant.

Agent Configuration


At the end of the script the agent is started. The installed agent should now be visible within the agent pool in VSTS.


Related Posts

Updates to my VSTS extensions Since a couple of months I have been developing extensions for Visual Studio Team Service (VSTS). I created extensions for task I had to do manual a c...
Invoke Azure Function in your Visual Studio Team Services CI/CD pipeline A utility task is available for Visual Studio Team Services (VSTS) to invoke an http triggered Azure function. The ability to invoke a Function from y...
VSTS Extension for Azure Role Based Access Control Today I published an extension for Visual Studio Team Services (VSTS) that gives you the ability to add and remove role based access assignments in Az...
Publish PowerBI files with Visual Studio Team Services Today I published an extension for Visual Studio Team Services (VSTS) that gives you the ability to deploy PowerBI files (pbix) to PowerBI.com. It use...
My first public VSTS Extension A couple of days ago I started developing extensions for Build and Release pipelines of Visual Studio Team Services (VSTS). One of these extensions is...
Protect your master Branch in VSTS You can set up permissions and policies to control who can read and update code in a branch on your Git repo within VSTS. You can set permissions for ...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.