Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

pool.demands definition

Demands (for a private pool).

Definitions that reference this definition: pool

Implementations

Implementation Description
demands: string Specify a demand for a private pool.
demands: string list Specify a list of demands for a private pool.

Remarks

Use demands to make sure that the capabilities your pipeline needs are present on the agents that run it. Demands are asserted automatically by tasks or manually by you.

Note

Demands and capabilities are designed for use with self-hosted agents so that jobs can be matched with an agent that meets the requirements of the job. When using Microsoft-hosted agents, you select an image for the agent that matches the requirements of the job, so although it is possible to add capabilities to a Microsoft-hosted agent, you don't need to use capabilities with Microsoft-hosted agents.

You can check for the presence of a capability (Exists operation) or you can check for a specific string in a capability (Equals operation). Checking for the existence of a capability (exists) and checking for a specific string in a capability (equals) are the only two supported operations for demands.

Task demands

Some tasks won't run unless one or more demands are met by the agent. For example, the Visual Studio Build task demands that msbuild and visualstudio are installed on the agent.

Manually entered agent demands

You might need to use self-hosted agents with special capabilities. For example, your pipeline may require SpecialSoftware on agents in the Default pool. Or, if you have multiple agents with different operating systems in the same pool, you may have a pipeline that requires a Linux agent.

Exists operation

The exists operation checks for the presence of a capability with the specific name. The comparison is not case sensitive.

pool:
 name: MyPool
 demands: myCustomCapability # exists check for myCustomCapability

Equals operation

The equals operation checks for the existence of a capability, and if present, checks its value with the specified value. If the capability is not present or the values don't match, the operation evaluates to false. The comparisons are not case sensitive.

pool:
 name: MyPool
 demands: Agent.Version -equals 2.144.0 # equals check for Agent.Version 2.144.0

Agent variables as system capabilities

Self-hosted agents have the following system capabilities with similar names to agent variables, but they are not variables and don't require variable syntax when checking for exists or equals in a demand.

  • Agent.Name
  • Agent.Version
  • Agent.ComputerName
  • Agent.HomeDirectory
  • Agent.OS
  • Agent.OSArchitecture
  • Agent.OSVersion (Windows agents only)

Agent capability scanning

When the agent software starts, it scans for the following software and tools and registers the corresponding capabilities.

Tip

After you install new software on a self-hosted agent, you must restart the agent for the new capability to show up. For more information, see Restart Windows agent, Restart Linux agent, and Restart Mac agent.

On Windows agents, the agent uses the following PowerShell scripts to scan for tools and software, and registers the corresponding capabilities. These scripts are part of the agent open source software and are located in the /src/Misc/layoutbin/powershell folder.

The following table was generated by Copilot. Copilot is powered by AI, so surprises and mistakes are possible. For more information, see Copilot general use FAQs.

Tool scanning script Capabilities
Add-AndroidSdkCapabilities.ps1 AndroidSDK
AndroidSDK_{version}
Add-AntCapabilities.ps1 ant
Add-ApplicationCapabilities.ps1 npm
gulp
node.js
bower
grunt
svn
cmake
docker
Add-AzureGuestAgentCapabilities.ps1 AzureGuestAgent
Add-AzurePowerShellCapabilities.ps1 AzurePS
Add-ChefCapabilities.ps1 Chef
KnifeReporting
Add-DotNetFrameworkCapabilities.ps1 DotNetFramework_{major.minor}
DotNetFramework_{major.minor}_x64
DotNetFramework
Add-JavaCapabilities.ps1 java_6
java_7
java_8
java_{major} (for versions 9 and later)
java_6_x64
java_7_x64
java_8_x64
java_{major}_x64 (for versions 9 and later)
java
jdk_6
jdk_7
jdk_8
jdk_{major} (for versions 9 and later)
jdk_6_x64
jdk_7_x64
jdk_8_x64
jdk_{major}_x64 (for versions 9 and later)
jdk

Detected JDK distributions include Oracle JavaSoft, AdoptOpenJDK, Eclipse Adoptium, Eclipse Foundation, and IBM Semeru.
Add-MavenCapabilities.ps1 maven
Add-MSBuildCapabilities.ps1 MSBuild_2.0
MSBuild_3.5
MSBuild_4.0
MSBuild_12.0
MSBuild_14.0
MSBuild_15.0
MSBuild_16.0
MSBuild_17.0
MSBuild_18.0
MSBuild
MSBuild_2.0_x64
MSBuild_3.5_x64
MSBuild_4.0_x64
MSBuild_12.0_x64
MSBuild_14.0_x64
MSBuild_15.0_x64
MSBuild_16.0_x64
MSBuild_17.0_x64
MSBuild_18.0_x64
MSBuild_x64
Add-PowerShellCapabilities.ps1 PowerShell
Add-ScvmmAdminConsoleCapabilities.ps1 SCVMMAdminConsole
Add-SqlPackageCapabilities.ps1 SqlPackage
Add-VisualStudioCapabilities.ps1 VisualStudio_10.0
VisualStudio_IDE_10.0
VisualStudio_11.0
VisualStudio_IDE_11.0
VisualStudio_12.0
VisualStudio_IDE_12.0
VSTest_12.0
VisualStudio_14.0
VisualStudio_IDE_14.0
VSTest_14.0
VisualStudio_15.0
VisualStudio_IDE_15.0
VSTest_15.0
VisualStudio_16.0
VisualStudio_IDE_16.0
VSTest_16.0
VisualStudio_17.0
VisualStudio_IDE_17.0
VSTest_17.0
VisualStudio_18.0
VisualStudio_IDE_18.0
VSTest_18.0
VisualStudio
VisualStudio_IDE
VSTest
Add-WindowsKitCapabilities.ps1 WindowsKit_{major.minor}
WindowsKit
Add-WindowsSdkCapabilities.ps1 WindowsSdk_{major.minor}
WindowsSdk_{major.minor}_{toolName}
WindowsSdk_{major.minor}_{toolName}_x64
WindowsSdk
Add-XamarinAndroidCapabilities.ps1 Xamarin.Android

demands: string

Specify a demand for a private pool.

demands: string # Specify a demand for a private pool.

demands string.

Specify a demand for a private pool.

Examples

To add a single demand to your YAML build pipeline, add the demands: line to the pool section.

pool:
 name: Default
 demands: SpecialSoftware # exists check for SpecialSoftware

demands: string list

Specify a list of demands for a private pool.

demands: [ string ] # Specify a list of demands for a private pool.

List types

Type Description
string Specify a list of demands for a private pool.

Examples

To specify multiple demands, add one per line.

pool:
 name: MyPool
 demands:
 - myCustomCapability # exists check for myCustomCapability
 - Agent.Version -equals 2.144.0 # equals check for Agent.Version 2.144.0

See also


Feedback

Was this page helpful?

Additional resources