category: [ VSTS / TFS ] tags: [ TFS ] [ TFS Build ] [ VSTS / TFS ]
created: 16 Oct 2015 @ 07:35 modified: 24 Apr 2017 @ 13:57
So you could make a script that can do the bits below but if you don’t here is how you can easily create build agents fast for TFS 2015+ or VSO.
Now I’m not saying you should run a million agents of a single machine but this could be applied the same if you switching between multiple TS sessions to configure on multiple servers.
Download the build agent
Downloading the build agent is really simple. Navigate to your TFS control panel, click on Agent pools and then Download agent.
This post will assume you have setup your agent pool already but that’s as simple as click New pool and giving it a name on the screen above
Setup agent file structure
Copy this to your build server and then extract the zip to look like below for example, create these folders.
then inside each of those folders you place a copy of the extracted zip
Get your configuration details
For this step we going option up old trusty notepad. What you are going to need is the following info in notepad, put each of these on a new line
- Agent Name
- Url to TFS
- Agent Pool
- Working directory (a blank line to use the default which is where your agent is with _working)
- Configure as a windows service (this post assumes a y)
- Service run as username
- Service run as password
- another empty line
this should look something like this
Setup lots of agents
This part is now fast . Make sure you in the directory with your ConfigureAgent.bat file
Run the ConfigureAgent.bat as administrator
You should see something like this now
Copy everything in your notepad, so you should have all that config with the extra new line at the end. Now right click in cmd and paste
and that would all work (if you want it to stay open you can open a cmd in admin and then run the bat file from there)
Now go to each folders ConfigureAgent.bat and run as admin, paste in the same config (changing just the agent name to increment the number at the end)
At this point if you go to your agent pool in TFS you will see they are all setup.
Gordon Beeming works at Nologo Studios in the sunny city of Durban, South Africa. He is the Lead for the Data and Services Team and has a strong focus on Developer Efficiencies and R&D. When he's not hacking away at a keyboard in Visual Studio he'll generally be relaxing with his family or hitting the black top getting in some mileage. He is a Visual Studio ALM Ranger and Visual Studio ALM MVP.