The below script is to trigger pipeline in Azure devops via REST, Its working fine on an existing pipeline, but when trying on newly created pipeline which has never ran then its throwing below error. Any help or suggestion would be really appreciated.
{"$id":"1","innerException":null,"message":"No pool was specified.\nUnexpected parameter 'pool'","typeName":"Microsoft.Azure.Pipelines.WebApi.PipelineValidationException, Microsoft.Azure.Pipelines.WebApi","typeKey":"PipelineValidationException","errorCode":0,"eventId":3000}
#!/bin/bash
echo "Enter PAT Token"
read -r PAT
echo "Enter Organization name"
read -r OrganizationName
echo "Enter Project ID"
read -r projectId
pipelineId=$(jq -r '.id' PipeOutput.txt) #Get definition ID from external TXT file
"Trigger_Pipeline=$(curl --write-out "%{http_code}\n" -X POST -L \
-u :"$PAT" "https://dev.azure.com/""${OrganizationName}""/""${projectId}""/_apis/pipelines/""${pipelineId}""/runs?api-version=6.0-preview.1" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{
"resources": {
"repositories": {
"self": {
"refName": "refs/heads/master"
}
}
}
}' --output Triggeroutput.txt --silent)"
echo "Output: $(Trigger_Pipeline)"