Posts Tagged ‘TFS2015’

Install TFS 2015 Build Agent on Premises

In the previous article, I showed how to install and configure Maven on the TFS Build server to build Java applications. This article however applies to either Java or .NET applications. This article is based on the version 1 of Build Agent TFS 2017 has a new build agent that I will blog about in the future.

Download the Build Agent

  • Go to http://<tfsUrl&gt;:8080/tfs/_admin
  • Click on the Agent pools tab
  • Click on Download agent
  • Extract the contents of the zip file to c:\Agents\1

Configure Build Agent as a Service (without executing UI Testing)

TFS Build Agents can run as a service or a user. From my experience, most build agents run as a service. You need to run as a user or interactively, when you have a build that performs UI testing such as Selenium or CodedUI.

  • Open command line
  • C:\Agents\1\ConfigureAgent.cmd

  • I have used the default options. When you enter the tfs url, make sure you add /tfs at the end of the url
  • The default user account is Network Service. You can use domain user account if you need to control the permissions

Configure Build Agent in Interactive mode (to Run Selenium or other UI Tests)

In this case, we need to configure the build agent to run interactively (i.e. answer to install ‘N’ it as a service). I also created a new Pool and called it Interactive to group all the agents that run in interactive mode.

  • Open command line
  • Extract the agent into C:\Agents\2
  • C:\Agents\2\ConfigureAgent.cmd

  • As mentioned above, I am using the new pool which is called Interactive and the agent is not running as a service.
  • When you enter the tfs url, make sure you add /tfs at the end of the url

View Agents on the Web Portal

  • Go to http://<tfsurl&gt;:8080/tfs/_admin/_AgentPool
  • Agents colour coded in green means that that they are online and connected to TFS. Otherwise, they will show in red
  • From this screen you can also disable or delete an agent

Categories: TFS2015, Uncategorized Tags: , ,

Use PowerShell to call TFS 2015 REST API’s

Few months ago, I was helping a client upgrading from TFS 2010 to 2015. After the upgrade, we were getting a message that says “This feature cannot be used until you configure it for this team project”.

Long story short, I had to upgrade the process template for over 77 team projects. Luckily they were all created using the Agile template 🙂 The process involves running some commands for the collection and others for each team project. That’s when I decided to script it with PowerShell.

In this post, I will show how to use Powershell to call the TFS 2015 REST API. Let me know in the comment section if you are interested in the script to upgrade the process template.

Show me the code

I am using the “Get list of team project” API which is listed at

$tfsUrl = 'http://tfsUrl:8080/tfs/'
$collectionName = 'DefaultCollection'
$collectionUrl =  "$($tfsUrl)$($collectionName)"
# Construct the Get list of team projects url
$getProjectsUrl = "$($collectionUrl)/_apis/projects/?api-version=1.0"

# Call the REST API using Invoke-RestMethod. -UseDefaultCredentials for using windows authentication
$json = Invoke-RestMethod -UseDefaultCredentials -uri $getProjectsUrl
$formatedJson =  $json | Format-List
Write-Output $formatedJson

The value field contains the data we need. It is just a matter of extracting the project names from the value field

$tpNames = $json.value | select name
Write-Output $tpNames

The above snippet only shows you a list of project names on the screen. Lets do something more interesting. Let’s say we want create a new team for each team project in a collection and call it Database Team

# Create team API
$createTeamUrl = "$($collectionUrl)/_apis/projects/{0}/teams?api-version=2.2"
#Json that contains the data to be POSTed
$Body = @{
            name = "Database"
            description = "Database Team"

# for each team project, create a team called Database by doing a post request to the create team api
    Invoke-RestMethod -Method Post -UseDefaultCredentials -uri ($createTeamUrl -f $ -Body (ConvertTo-Json $Body) -ContentType "application/json"


It is really convent and powerful to use Powershell or any other scripting language to TFS’s REST API. To learn more about TFS’s REST APIs visit

Fix TFS 2015 Build’s Queue is Empty

Today I wasn’t able to select a queue while creating a build definition or queuing a build using the new build engine that comes with TFS 2015. The drop down was blank.

This problem may occur if you don’t have build queues for your Collection or if you don’t have permission to use the queues in your build definition.

Go to the administration site for your collection

Check if you have queues for Collection

If you do, select your queueĂ  Role Ă  Agent Queue Users Ă  Double click on Agent Queue Users Ă  add users or groups

Otherwise click the “New queue” link to create a new queue

TFS Build 2015 Gated Check-in Announced

In case you missed the news, the Visual Studio product team at Microsoft has announced the Gated check-in support for TFS Build 2015 (aka Build vNext) for TFVC repository. For more info visit




Categories: TFS2015, Uncategorized Tags: , ,

TFS Build: Unable to load task handler PowerShell for task …

While I was trying run a TFS build for the first time on a Windows 2008 R2 SP1 machine, I got the following error

Unable to load task handler PowerShell for task Maven with version 1.0.13

To determine the Powershell version that is installed on your system:

Open Windows Powershell

Type $PSVersionTable.PSVersion

If you have a version that is lower than 3.0, you will need to update to a recent version of Powershell

In my case, I had PS 2.0 installed. I upgraded to PS 4.0 which I downloaded from

and that fixed my issue

PS: read the installation instructions to determine proper file name to download


Categories: ALM, TFS2015 Tags: , , , , ,

Install TFS2015 ctp with basic configurations

Categories: Uncategorized Tags:

TFS2015 CTP and VS2015 CTP6 are available for download

In case you missed the news, Visual Studio 2015 CTP 6 and TFS 2015 CTP are available for download. The following link contains the release notes and the bits

Remember not to install CTP products on your production machines. They are for testing purposes and are not supported

Categories: Uncategorized Tags: ,