Jun 192015
 

Visual Studio Online (VSO) has a new build system that will eventually replace the old XAML based system.

VSO now also lets you perform builds using an on-prem build agent (or one hosted in a VM on Azure etc.).

I haven not been able to find information about this, but I assume that using on-prem agents will not count against the VSO build minutes. I assume that running builds are “free” contrary to using hosted agents, where there are 60 minutes included in VSO, and then you have to pay for additional.

Setting up the build agent is quite simple: Download the agent.zip file from VSO, unzip it and run the “ConfigureAgent.ps1” PowerShell script:

PS C:\vsobuildagent> .\ConfigureAgent.ps1
Enter the name for this agent (default is Agent-BUILD02):
Enter the url for the Team Foundation Server (default is https://<myaccount>.visualstudio.com):
Configure this agent against which agent pool? (default pool name is On-prem build agents'):
Enter the path of the work folder for this agent (default is 'C:\vsobuildagent\_work'):
Would you like to install the agent as a Windows Service (Y/N) (default is Y):
Enter the name of the user account to use for the service (default is NT AUTHORITY\NetworkService):
Would you like to unconfigure any existing agent (Y/N) (default is N; the agent will be updated):
Configuring agent
Unblocking files
Agent is already configured, attempting to reconfigure the existing agent.
Calling agent configure with /RunningAsService
Calling agent configure with /Force
Agent: Starting
Authenticating to the server https://<myaccount>.visualstudio.com
Removing EventLog source vsoagent.<myaccount>.Agent-BUILD02.
Service vsoagent.<myaccount>.Agent-BUILD02 is being removed from the system...
Service vsoagent.<myaccount>.Agent-BUILD02 was successfully removed from the system.
Attempt to stop service vsoagent.<myaccount>.Agent-BUILD02.
Installing service vsoagent.<myaccount>.Agent-BUILD02...
Service vsoagent.<myaccount>.Agent-BUILD02 has been successfully installed.
Creating EventLog source vsoagent.<myaccount>.Agent-BUILD02 in log Application...
Configure agent succeeded.
Agent is now running as a Windows Service.
PS C:\vsobuildagent>

During the run, it prompts you for the account to use when logging in to VSO. The account is only used to figure out to which VSO subscription the agent should connect.

When the script runs, it also detects which versions of Visual Studio as well as other SDK’s are installed on the build machine. The above output is actually from running the script a second time after I installed the Azure SDK.

The installed Visual Studio versions, Azure SDK etc. are registered as build agent capabilities in VSO. The VSO build process only selects agents that have the required capabilities. – For instance, there is no purpose in making an agent perform a build which includes an Azure deploy unless the agent has the Azure tools installed.

If you want the agent to be placed in a different agent pool you can create and manage agent pools in the VSO Control panel:

image

Here you can also see the capabilities of each agent and add custom capabilities which the build script can demand.

This agent has number of Visual Studio versions installed as well as the Azure SDK 2.6:

image

This build definition requires the “azureps” capability and uses my on-prem build agents’ queue/pool:

image

That is pretty much all there is to configuring an on-prem build agent and using it in a build with the new build system in Visual Studio Online.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)