parameters:
- name: testparam
type: string
default: "default"
steps:
- script: echo hi
jobs:
- job: CallDeploymentPipeline
pool: Server
steps:
- task: InvokeRESTAPI@1
displayName: Call different-project Pipeline
inputs:
connectionType: 'connectedServiceName'
serviceConnection: "myGenericServiceConnectionName"
method: 'POST'
headers: '{ "Authorization":"Bearer $(System.AccessToken)", "Content-Type":"application/json" }'
body: '{
"resources": { "repositories": { "self": { "refName": "$(Build.SourceBranch)" } } },
"templateParameters": { "testparam": "test" }
}'
urlSuffix: '/ProjectA/_apis/pipelines/<deploy pipeline ID>/runs?api-version=7.1'
waitForCompletion: 'false'
I get back:
Response: An error was encountered while processing request. Exception: {"$id":"1","innerException":null,"message":"The repository RepoA in project could not be retrieved. Verify the name and credentials being used.","typeName":"Microsoft.TeamFoundation.DistributedTask.Pipelines.ResourceValidationException, Microsoft.TeamFoundation.DistributedTask.WebApi","typeKey":"ResourceValidationException","errorCode":0,"eventId":3000} Exception Message: The remote server returned an error: (500) Internal Server Error. (type WebException)
This works if any one of the following are changed:
"templateParameters": { "testparam": "test" }
)Yes, I have followed the docs and set Limit job authorization scope to current project for non-release pipelines OFF for the org and project.
Yes, Project Collection Build Service has Read access to my repo and Queue Build permission to deploy pipeline.
Am I doing anything wrong or is this a bug?
I can reproduce the same error:
This is due to the lack of permission on Project A pipeline, please Manage security
on Project A pipeline -> set Edit queue build configuration
as Allow
for Project Collection Build Service(orgname)
.
Permission on my side for your reference:
The result: