Florian Eckert
Florian Eckert

Reputation: 311

Azure DevOps - update Agent pool owner

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?

Upvotes: 1

Views: 2533

Answers (3)

Mengdi Liang
Mengdi Liang

Reputation: 18978

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 specify the value of owner.

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.

Upvotes: 3

Florian Eckert
Florian Eckert

Reputation: 311

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

?

Upvotes: 0

Shayki Abramczyk
Shayki Abramczyk

Reputation: 41545

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.

Upvotes: 0

Related Questions