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 | AndroidSDKAndroidSDK_{version} |
| Add-AntCapabilities.ps1 | ant |
| Add-ApplicationCapabilities.ps1 | npmgulpnode.jsbowergruntsvncmakedocker |
| Add-AzureGuestAgentCapabilities.ps1 | AzureGuestAgent |
| Add-AzurePowerShellCapabilities.ps1 | AzurePS |
| Add-ChefCapabilities.ps1 | ChefKnifeReporting |
| Add-DotNetFrameworkCapabilities.ps1 | DotNetFramework_{major.minor}DotNetFramework_{major.minor}_x64DotNetFramework |
| Add-JavaCapabilities.ps1 | java_6java_7java_8java_{major} (for versions 9 and later)java_6_x64java_7_x64java_8_x64java_{major}_x64 (for versions 9 and later)javajdk_6jdk_7jdk_8jdk_{major} (for versions 9 and later)jdk_6_x64jdk_7_x64jdk_8_x64jdk_{major}_x64 (for versions 9 and later)jdkDetected JDK distributions include Oracle JavaSoft, AdoptOpenJDK, Eclipse Adoptium, Eclipse Foundation, and IBM Semeru. |
| Add-MavenCapabilities.ps1 | maven |
| Add-MSBuildCapabilities.ps1 | MSBuild_2.0MSBuild_3.5MSBuild_4.0MSBuild_12.0MSBuild_14.0MSBuild_15.0MSBuild_16.0MSBuild_17.0MSBuild_18.0MSBuildMSBuild_2.0_x64MSBuild_3.5_x64MSBuild_4.0_x64MSBuild_12.0_x64MSBuild_14.0_x64MSBuild_15.0_x64MSBuild_16.0_x64MSBuild_17.0_x64MSBuild_18.0_x64MSBuild_x64 |
| Add-PowerShellCapabilities.ps1 | PowerShell |
| Add-ScvmmAdminConsoleCapabilities.ps1 | SCVMMAdminConsole |
| Add-SqlPackageCapabilities.ps1 | SqlPackage |
| Add-VisualStudioCapabilities.ps1 | VisualStudio_10.0VisualStudio_IDE_10.0VisualStudio_11.0VisualStudio_IDE_11.0VisualStudio_12.0VisualStudio_IDE_12.0VSTest_12.0VisualStudio_14.0VisualStudio_IDE_14.0VSTest_14.0VisualStudio_15.0VisualStudio_IDE_15.0VSTest_15.0VisualStudio_16.0VisualStudio_IDE_16.0VSTest_16.0VisualStudio_17.0VisualStudio_IDE_17.0VSTest_17.0VisualStudio_18.0VisualStudio_IDE_18.0VSTest_18.0VisualStudioVisualStudio_IDEVSTest |
| Add-WindowsKitCapabilities.ps1 | WindowsKit_{major.minor}WindowsKit |
| Add-WindowsSdkCapabilities.ps1 | WindowsSdk_{major.minor}WindowsSdk_{major.minor}_{toolName}WindowsSdk_{major.minor}_{toolName}_x64WindowsSdk |
| 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?
