How to register capabilities on your build and release management agents

To run Selenium test against different browsers using our new build and release systems the browser must be installed on the agent machine.  The question is how can we identify which agents have which browsers.  Our new build and release systems use the same agents and the agents let you identify agent capabilities.

You can add a user capability but you have to do this for each agent.  If you installed 8 agents on the same machine you would have to add the same capability to each of the 8 agents.  However, there is a way to register a capability to the machine that all the agents will automatically pick up.  For example if you wanted to identify that you had version 44 of Chrome installed on a machine you can simply define a System Variable.

After doing so, restarting your agents will have each of them automatically pick up new capability.

Now you can define Chrome as a demand on your build or release and only agents that have the Chrome capability will be selected to execute the build or release.

Comments (21) -

  • Great Post Donovan, I was at Build 2015 when you demonstrated some of these features.  This Environment variable setting is very helpful.  One thing I am curious about.  I noticed that some of the demands are coming from a location other than Environment variables.  If I were to say install software on the machine, is there another location I could use to add the "demand" to the system?  I would prefer not to have some persnickety sys admin decided to clean up the Environment Variables one day and screw my demands up.

    Thanks again, great work on the new TFS
    • Sorry for the delay. You can use the User capabilities section on the Agent pools page from the Administration pages of your VSO account.  That way only VSO administrators can control the capabilities.
  • Thanks for a great post.

    Sorry for being late to the party, but I have a question regarding User Capabilities. According to this page: (see the description of User Capabilities), it's possible to use User Capabilities to specify paths for tools on a specific agent. I can't find any other documentation about this and I can't get it to work, so I'm wondering how I do this?
    • Trying to track down an answer.
      • I'm also struggling with this: I have user capabilities specifying the local path of a specific tool, which can vary per agent. Now all I need is a way to get that path exposed but I haven't found the solution yet.
        • Have you solve this problem?
      • I believe there is a bug here, unless i'm missing something.  on-prem tfs 2015 update 2.  if you create user capability for a agent then I cannot use that value in the builds.  for example, under hosts > agent I created a user capability called "PathtoXYZ" and when I tried to use this in by build $(PathtoXYZ) it would not be found.  even tried restarting the agent. no luck. Frown
  • Hi Donovan,
    We updated java home path in a Linux agent but the Agent is not picking that change - it is still referencing the old version.  The agent was re-started but this did not solve it.  Any thoughts?
    • Stop the agent
      cd to agent folder
      delete .env

      You should get a new .env

      start agent.
  • I have specified an agent-specific value as a User Capability which I want to retrieve during a build as a variable. The VS documentation ( implies that this is possible, but no variable or value exists when the build is running. (I'm using TFS 2015 Update 3) Am I missing something here? How do I access the User Capability name/value pairs from within steps in my build? Thanks.
    • I think they are in env vars.
  • Hi Donovan,

    I dont see option of restarting a hosted agent. I just added Chrome in User Capabilities. Is this something to do with free account?

  • ok, update - I have installed private agents and have better control.
  • Hi Donovan,

    We are building a project using VSTS build definition. For signing the apk file we use a KeyStore file and we wanted to be very secure in storing the file. We have an on premise Mac build agent configured and decided to place the file in some location and reference the path in the build definition to pick the KeyStore file. It works with the hard coded absolute path but we would like to add this as a capability in the build definition then reference using the capability. Is that possible? Please advice.

  • Hi Donovan,

    I can not get this to work on linux Agents. set Env variables bevor register the agent but none of my values showed up in the list on my TFS Server.
    I did not find any documentation abut this.

    Many Thanks,
  • I can set demands in build definition but how do we set it in release definitions? is picking the agent based on capability not available for releases?
  • Donovan,

    Is it possible to set a user capability programatically (PowerShell preferred)? I'd like to add this to our build server Infrastructure as Code.

    Thank you in advance,
  • Donovan,
    I have a containerized build agent running in AKS cluster which is linked to my agent pool in VSTS, how ever that agent is missing some capabilities , the base image I am using in my Dockerfile is ubuntu, can you help me how can i add capabilities in the containerized VSTS agent?? please

    Thank you in advance,
    • I would pass in environment var values when you start your container. They should then show up as capabilities.

  • Im getting the below error while executing  "install npm " in VSTS 2015 build definition?
    Error: "No agent could be found with the following capabilities: npm ".
    Is there any way  to add capability for npm in VSTS 2015?
  • Hi Donovan,
    I need to do the opposite of what you are doing in this article. I need to have capabilities set on a per-agent basis even it the agents are running on the same machine. I see how to do that through the UI for build agents (Organization Settings->Agent pools->select agent->select Capabilities->Add Capability) but I don't see the same ability for a Deployment agent.
    Organization Settings->Deployment pools->select agent seems to show a read-only list of capabilities.

    Is there something I'm missing?

Pingbacks and trackbacks (4)+

Add comment