检查代理池是否映射到 Azure DevOps 中的集合项目?

Check if an agent pool is mapped to a collection project in Azure DevOps?

在 Azure DevOps Server 中,代理池的范围限定为整个服务器,如文档所述here。 但是,只有将代理池“导入”到项目中的项目才能真正使用它。我的问题是 - 有没有一种方法可以使用 REST API 检查一个项目是否被授权使用特定的代理池?

我知道有这个 REST 方法:

GET https://dev.azure.com/{organization}/_apis/distributedtask/pools?api-version=6.0

这会为您提供集合中所有代理池的列表。 (顺便说一句——如果代理池的范围是整个服务器,为什么这个调用的范围是特定的集合?) 但是在响应中无法知道代理池映射到哪些项目。

Check if an agent pool is mapped to a collection project in Azure DevOps?

恐怕没有这种方法可以检查代理池是否映射到 Azure DevOps 中的集合项目。

根据文档Agent pools

pools are scoped to the entire organization; so you can share the agent machines across projects. In Azure DevOps Server, agent pools are scoped to the entire server; so you can share the agent machines across projects and collections.

这意味着组织或 Azure DevOps Server 中的整个管道都可以访问此代理池。

换句话说,代理池映射到 Azure DevOps 服务中的所有项目和 Azure devops 服务器的所有集合。

您应该使用此 API 检查代理池是否绑定到特定的 Azure DevOps 项目。 实际上 queueName == agentPoolName

GET https://dev.azure.com/{organization}/{project}/_apis/distributedtask/queues?queueNames={queueNames}&api-version=6.1-preview.1

API Document