Create and manage agent pools
TFS 2017 | TFS 2015
Agent pools are scoped to project collections.

Navigate to your project and choose Manage project (gear icon).

Choose Control panel.

Select Agent pools.

Navigate to your project and choose Manage project (gear icon).

Choose Control panel.

Select the desired project collection, and choose View the collection administration page.

Select Agent Queues (For TFS 2015, Select Build and then Queues).

Default agent pools
The following agent pools are provided by default:
- Default pool: Use it to register self-hosted agents that you've set up.
Designate a pool in your pipeline
To choose a Microsoft-hosted agent from the Azure Pipelines pool in your Azure DevOps Services YAML pipeline, specify the name of the image, using the YAML VM Image Label from this table.
pool:
vmImage: ubuntu-latest # This is the default if you don't specify a pool or vmImage.
To use a private pool with no demands:
pool: MyPool
For more information, see the YAML schema for pools.
Manage pools and queues
Navigate to your project and choose Manage project (gear icon).

Choose Control panel.

Select Agent pools.

Navigate to your project and choose Manage project (gear icon).

Choose Control panel.

Select the desired project collection, and choose View the collection administration page.

Select Agent Queues (For TFS 2015, Select Build and then Queues).

Pools are used to run jobs. Learn about specifying pools for jobs.
If you've got a lot of self-hosted agents intended for different teams or purposes, you might want to create additional pools as explained below.
Create agent pools
Here are some typical situations when you might want to create self-hosted agent pools:
Security of agent pools
Understanding how security works for agent pools helps you control sharing and use of agents.
TFS 2015
In TFS 2015, special groups are defined on agent pools, and membership in these groups governs what operations you can perform.
Members of Agent Pool Administrators can register new agents in the pool and add additional users as administrators or service accounts.
Add people to the Agent Pool Administrators group to grant them permission manage all the agent pools. This enables people to create new pools and modify all existing pools. Members of Team Foundation Administrators group can also perform all these operations.
Users in the Agent Pool Service Accounts group have permission to listen to the message queue for the specific pool to receive work. In most cases you should not have to manage members of this group. The agent registration process takes care of it for you. The service account you specify for the agent (commonly Network Service) is automatically added when you register the agent.
FAQ
If I don't schedule a maintenance window, when will the agents run maintenance?
If no window is scheduled, then the agents in that pool will not run the maintenance job.
What is a maintenance job?
You can configure agent pools to periodically clean up stale working directories and repositories. This should reduce the potential for the agents to run out of disk space. Maintenance jobs are configured at the project collection or organization level in agent pool settings.
To configure maintenance job settings:
Navigate to your project and choose Manage project (gear icon).

Choose Control panel.

Select Agent pools.

Choose the desired pool and choose Settings to configure maintenance job settings for that agent pool.
Important
You must have the Manage build queues permission to configure maintenance job settings. If you don't see the Settings tab or the Maintenance History tab, you don't have that permission, which is granted by default to the Administrator role. For more information, see Security of agent pools.
Configure your desired settings and choose Save.
Select Maintenance History to see the maintenance job history for the current agent pool. You can download and review logs to see the cleaning steps and actions taken.
The maintenance is done per agent pool, not per machine; so if you have multiple agent pools on a single machine, you may still run into disk space issues.
The maintenance job of my self-hosted agent pool looks stuck. Why?
Typically, a maintenance job gets "stuck" when it's waiting to run on an agent that is no longer in the agent pool. This happens when, for example, the agent has been purposefully taken offline or when there are issues communicating with it.
Maintenance jobs that have been queued to run will wait seven days to run. Afterward, they'll be automatically canceled if not run. The limit is hardcoded in the system and cannot be changed.
The seven-day limit is different from the maintenance job timeout setting. The latter controls the maximum number of minutes an agent can spend doing maintenance. The timer starts when the job starts, not when the job is queued on an agent.
I'm trying to create a project agent pool that uses an existing organization agent pool, but the controls are grayed out. Why?
On the 'Create a project agent pool' dialog box, you can't use an existing organization agent pool if it is already referenced by another project agent pool. Each organization agent pool can be referenced by only one project agent pool within a given project collection.
