【发布时间】:2019-12-12 22:56:16
【问题描述】:
可以通过 UI 更新自托管 Azure DevOps 代理池的所有者:
我尝试通过 UI -> 组织设置 -> 代理池 -> 详细信息
我尝试通过 UI -> 项目设置 -> 代理池 -> 详细信息
是否可以通过 REST Api 实现?
【问题讨论】:
标签: azure-devops azure-devops-rest-api azure-devops-hosted-agent
可以通过 UI 更新自托管 Azure DevOps 代理池的所有者:
我尝试通过 UI -> 组织设置 -> 代理池 -> 详细信息
我尝试通过 UI -> 项目设置 -> 代理池 -> 详细信息
是否可以通过 REST Api 实现?
【问题讨论】:
标签: azure-devops azure-devops-rest-api azure-devops-hosted-agent
最近发布的新功能后,不支持通过UI更改代理池的所有者。您现在只能使用REST api 更改它。
PATCH https://dev.azure.com/{organization}/_apis/distributedtask/pools/{poolId}?api-version=5.1
对于请求体,由于你只是想改变所有者,根据doc的请求体,你只需要指定所有者的值就可以了。这是请求正文的示例:
{
"owner": {
"displayName": "{owner name displayed}",
"uniqueName": "{owner account: xxx@xx.com}"
}
}
注意:请不要尝试将isLegacy 添加到请求正文中,发生错误,正在准备发布针对此问题的修复。有关更多详细信息,您可以参考此ticket。
【讨论】:
是的,有Pools - Update Rest API更新池子:
PATCH https://dev.azure.com/{organization}/_apis/distributedtask/pools/{poolId}?api-version=5.1
在请求正文中,您可以提供owner。
【讨论】:
感谢您的回复。
什么对我有用
PATCH https://dev.azure.com/<myOrg>/_apis/distributedtask/pools/<poolId>?api-version=5.1 HTTP/1.1
{
"owner" : {
"displayName": "<name>",
"uniqueName" : "<name@contoso.com>",
"descriptor" : "<userDescriptor>" // it didn't work without this property
}
}
UI 显示更新后的所有者
https://dev.azure.com/<myOrg>/_settings/agentpools
但 agentPool 详细信息显示旧所有者
https://dev.azure.com/<myOrg>/_settings/agentpools?poolId=<poolId>&view=details
?
【讨论】: