Posts Tagged ‘TFS’

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

About Lajak Technologies

A consulting firm in Ottawa, Ontario that provides services related to Microsoft technologies, Team Foundation Server, DevOps practices, security and more. Contact us today to help you solving your complex software problems. Visit us at

Categories: TFS2015, Uncategorized Tags: , ,

Configure a TFS 2015 Build Server for Java


TFS 2015 comes with a new build engine. It supports building many programming languages such as .NET, Java, Xcode, Android and other languages. You can even have a build agent on Linux. For more information visit

In this document, I will show how to configure a build server to run Java Maven builds.

Installing maven

System Requirements (Copied from Maven website)

  • Java Development Kit (JDK) Maven 3.3 requires JDK 1.7 or above to execute – it still allows you to build against 1.3 and other JDK versions by Using Toolchains
  • Memory No minimum requirement
  • Disk Approximately 10MB is required for the Maven installation itself. In addition to that, additional disk space will be used for your local Maven repository. The size of your local repository will vary depending on usage but expect at least 500MB.
  • Operating System No minimum requirement. Start up scripts are included as shell scripts and Windows batch files.

Installing Java

Make sure you install the JDK and not just the JRE. Other than that, the installation itself should be straightforward

Create the Environment Variable JAVA_HOME

  • Go to Control panel –> System and Security –> System –>Advanced system settings –> Advanced –> Environment Variables
  • Add new System variable and enter JAVA_HOME as “the Variable name” and jdk path

  • Restart the machine
  • To test, open commandline and type echo %JAVA_HOME%

Download Maven

At the time of writing this document, Maven 3.3.9 was the latest version of Maven. Download Binary zip archive from I created a folder at c:\JavaTools to have my Java related tools. I extracted the contents of the zip file into c:\JavaTools folder

Test Maven from commandline by typing c:\JavaTools\apache-maven-3.3.9\bin\mvn -v . If you have all the prerequisites, you should see something similar to the following output

c:\JavaTools\apache-maven-3.3.9\bin\mvn -v

Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T11:41:47-05:00)

Maven home: c:\JavaTools\apache-maven-3.3.9\bin\..

Java version: 1.8.0_72, vendor: Oracle Corporation

Java home: C:\Program Files\Java\jdk1.8.0_72\jre

Default locale: en_US, platform encoding: Cp1252

OS name: “windows server 2008 r2”, version: “6.1”, arch: “amd64”, family: “dos”

Create an M2_HOME Environment Variable

  • Create M2_HOME system variable with a value of the Maven folder

  • Restart the machine logout and log back in

What’s Next

In the next blog post, I will show how to install and configure Team Build agents in TFs 2015.


About Lajak Technologies

A consulting firm in Ottawa, Ontario that provides services related to Microsoft technologies, Team Foundation Server, DevOps practices, security and more. Contact us today to help you solving your complex software problems. Visit us at

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

About Lajak Technologies

A consulting firm in Ottawa, Ontario that provides services related to Microsoft technologies, Team Foundation Server, DevOps practices, security and more. Contact us today to help you solving your complex software problems. Visit us at



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


About Lajak Technologies

A consulting firm in Ottawa, Ontario that provides services related to Microsoft technologies, Team Foundation Server, DevOps practices, security and more. Contact us today to help you solving your complex software problems. Visit us at

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: , ,

Azure Cloud Load Testing – Part 2

In the previous blog post, I showed how easy it is to initiate a load test from Azure by just providing a URL of the web page you want to load test, specify the number of users and the duration. This is great for websites where requests are GET requests or you are not trying to test a user scenario that consists of multiple steps. In this post, I will show how to use Azure Cloud Load Testing in a more advanced scenario that consists of multiple steps.


In order to record a performance test which will be used for load testing, you need to have Visual Studio Enterprise or Ultimate Edition. You can download a 30 day trial version

Recording a Scenario

  • Open Visual Studio
  • Create a new Web Performance and Load Test project

  • Click the record button on your web test

  • Go through the scenario you want to record. I uploaded the scenario I recorded at
  • I recorded a test to go from the home page to the search page and then perform a search

You can test your script by clicking the run test button

Create a Load Test

A load test can consist of one or more test scenario. You can also define the duration of your test and the number of users to simulate running the test. Let’s create and configure a load test which will run in Azure.

  • Right click on your project
  • Add a load test by right clicking on the project and add a new itm

  • On the wizard, I am selecting a Cloud-based Load Test and click next

  • Select the location where the load will be generated from and click next

  • On the Run Settings page, you select the duration of the run and then click next

  • On the scenario page, name the scenario and select the Think time profile, think time is the duration between your test steps

  • On the Load pattern page, you can select a constant load of users or if you want to start with a smaller number of users and ramp up the user users while your test is running. I am using a constant load but you may want to use the second option if that what you want to simulate.

  • On the test mix page, you can select one or more tests. in my case I am only selecting one web test. You can also selected MSTest unit tests as well.

  • Add the browsers you want your users to use during the test

  • Click the Run load test button

  • Click on the Performance or Throughput buttons to see the graphs. The application button with capture the Application Insights telemetry


In this post, I showed how to create a performance and load test using Visual Studio 2015 Enterprise Edition and leverage Azure Cloud Load Testing to execute the recorded test. I didn’t have to create any Virtual Machines or install test agents to run my load test. I had to push a button and monitor the test run. Cloud load testing would save you a lot of money in infrastructure purchases and labour costs when you want to run load tests to similar millions of users and you want to only run the test scenarios for few weeks a year. The first 20,000 Virtual User Minutes (VUMs) a month are free. Give it a try today.

Offline Installation of TFS Eclipse Plugin

I was working with one client with a locked down dev environment (i.e. no internet access on dev machines). They use TFS as their ALM tool. Long story short, I wanted to install the TFS Eclipse Plugin. The following are the steps that I went through to install the plugin offline.

Download TFS Eclipse Plugin (version 14.02 is available at

  • Open Eclipse
  • Click on Help à Install New Software

  • Click the Add button then the Archive button
  • Select the zip file for the TFS Eclipse plugin
  • Click the Open button

  • Check The Team Explorer Everywhere plugin and click the next button. Eclipse will calculate the dependency. This may take few minutes

  • Click the next button on Install Details window

  • Accept the license agreement and click the Finish button
  • Click Yes to restart Eclipse

  • Click the Open Perspective button, Select Team Foundation Sever Exploring and click OK

Connect Eclipse to TFS Server

  • Click on Connect to Team Foundation Server then click the Servers button
  • Click the Add button to add a new TFS server
  • Type in the TFS url

  • Click OK and close the Add/Remove TFS window
  • Select your team project and click the Finish button

Categories: ALM, Uncategorized Tags: , , ,