Pipeline creation with Azure DevOps REST API fails with error "No pool was specified"

Viewed 1647

Pipelines are not getting created when Azure DevOps REST API is used for creation. I have used - Create - Rest API. Please find the request URI and request body used below:

Request : POST https://dev.azure.com/{organization}/{project}/_apis/pipelines?api-version=6.0-preview.1

Request Body:

{
"folder": "",
"name": "pipeline-by-api",
"configuration": {
    "type": "yaml",
    "path": "/azure-pipelines.yml",
    "repository": {
        "id": "00000000-0000-0000-0000-000000000000",
        "name": "repo-by-api",
        "type": "azureReposGit"
    }
}

}

Below is the response received:

{
"$id": "1",
"innerException": null,
"message": "No pool was specified.",
"typeName": "Microsoft.TeamFoundation.Build.WebApi.QueueNotFoundException, Microsoft.TeamFoundation.Build2.WebApi",
"typeKey": "QueueNotFoundException",
"errorCode": 0,
"eventId": 3000

}

Pool is specified in the YAML file as below:

pool:
 name: #######
 demands:
 - maven

If I try to create pipeline manually, it is working successfully. Issue exist only when it is created from Azure DevOps REST API.

3 Answers

Pipeline creation with Azure DevOps REST API fails with error “No pool was specified”

If you are using the variable for the agent pool name, please try to use hardcoded agentpool name.

AFAIK, the variable are secured and downloaded directly to the agent and cannot be used for pool names since this is needed to be resolved on the server seems a false statement.

You could check this thread for some more details.

I faced the same problem with you: when I used REST API for pipeline creation, it always remind me "No pool was specified." But when I try to create pipeline manually, it works successfully. Maybe you can try to change the REST API version, not using version= 6.0-preview.1, you can set your pipeline Request : POST https://dev.azure.com/{organization}/{project}/_apis/pipelines?api-version=6.1-preview.1

Another question: Did you set your YAML file and specify your pool before creating pipeline by REST API?

I have been experiencing the same issue and I was able to resolve it by ensuring that a branch in the repository was set as the default branch.

Related