0
votes

When I create a new project, there are missing agent pools which are available in collection. Indented or not, I need to add the agent pools to the new project. Therefore you have this menu:

enter image description here

is it possible to execute this process by Azure DevOps Rest API?

I seek through the documentation but all I found is Pools - Get Agent Pools. Issue here is that there is no project scope, only collection scope. So the call give me all Agent Pools from collection but not from a single project.

And even there is call to get all pools from a project, you still need a call to add a existing agent pool to the project.

How could I solve that problem?


Azure DevOps 2020.1 (on prem)
Self hosted agents
1

1 Answers

1
votes

is it possible to execute this process by Azure DevOps Rest API?

Yes. You could use Rest API to add existing agent pool.

You need to check the Browser Console to get this Rest API.

enter image description here

Azure DevOps 2020.1 (on prem)

You could use the following Rest API:

POST https://{instance}/{collection}/{project}/_apis/distributedtask/queues?authorizePipelines=true&api-version=5.0-preview.1

Request Body:

{
    "name":"xx",
    "pool":
        {
            "id":2
        }
}

You could get the Agent Pool id in Organization Settings -> Agent Pools -> Target Agent Pool.

enter image description here

Update:

To get all project agent pools, you could use the following rest api:

Get https://{instance}/{collection}/{project}/_apis/distributedtask/queues?api-version=5.0-preview.1