I have tried to use the definition update api to try to update the 'Default agent pool for YAML' but no success. I kept receiving '200' response status code but the setting stay the same.
I have also tried to capture the actual request content when perform the update manually via UI, then pretty much copied the same content into the Body of the request but the result stayed the same.
Below is a sample of the request that I'm using:
Invoke-WebRequest -URI "https://dev.azure.com/***/***/_apis/build/definitions/***?api-version=6.1-preview.7" -Method PUT -ContentType "application/json" -Headers @{ Authorization = "Basic ***" } -Body '{***}'
The body is in the JSON format of:
{
...
"queue": {
"id": 882,
"name": "Azure Pipelines",
"pool": {
"id": 17,
"name": "Azure Pipelines",
"isHosted": true
}
},
...
}
Update As suggested by the Microsoft team, the feature is not supported. I have logged a suggestion for the feature here.