1
votes

It is possible to update the owner of an self hosted Azure DevOps agent pool via the UI:

I tried via UI -> Organization settings -> agent pools -> details
I tried via UI -> Project settings -> agent pools -> details

Is it possible via the REST Api?

3

3 Answers

2
votes

After the new feature released recently, it does not support change the owner of agent pool with UI. You can only change it with REST api now.

PATCH https://dev.azure.com/{organization}/_apis/distributedtask/pools/{poolId}?api-version=5.1

For request body, since you just want to change the owner, according to the request body of doc, you just need to specified the value of owner is ok. Here is the sample of request body:

{
    "owner": {
        "displayName": "{owner name displayed}",
        "uniqueName": "{owner account: [email protected]}"
    }
}

Note: Please do not try to add isLegacy into request body, something wrong occurred and the fixed for this issue is being prepared for release. For more details you can refer to this ticket.

0
votes

Yes, there is Pools - Update Rest API to update the pool:

PATCH https://dev.azure.com/{organization}/_apis/distributedtask/pools/{poolId}?api-version=5.1

In the request body you can give the owner.

0
votes

Thanks for the replies.

What 'kind of' worked for me was

PATCH https://dev.azure.com/<myOrg>/_apis/distributedtask/pools/<poolId>?api-version=5.1 HTTP/1.1

{
  "owner" : {
    "displayName": "<name>",
    "uniqueName" : "<[email protected]>",
    "descriptor" : "<userDescriptor>" // it didn't work without this property
  }
}

the UI shows the updated owner

https://dev.azure.com/<myOrg>/_settings/agentpools

but the agentPool details show the old owner

https://dev.azure.com/<myOrg>/_settings/agentpools?poolId=<poolId>&view=details

?