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:
.\config.cmd
  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.

image

Related Posts

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 ...
The Build announcement I got from Build 2017 Day 1 This year is my second year at Build. Most announcement during Build are given on Day 1. This blog post is a summary of announcement that I heard of d...
Azure Function CI – 3. Deploying the Azure Function from the Build within VSTS This post is the third and last one in a series of posts and will help you by deploying a CI build for a Azure Function. Prerequisites This blog post ...
Azure Function CI – 2. Create a CI Build for the Azure Function This post is the second one in a series of three posts and will help you by creating a CI build for a Azure Function. Prerequisites This blog post i...

Leave a Reply

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