Project A: deploy.yml
parameters:
- name: testparam
type: string
default: "default"
steps:
- script: echo hi
Project B: pipeline.yml
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:
- No parameter is passed (i.e. this line is removed
"templateParameters": { "testparam": "test" }
) - OR PAT is used vs System.AccessToken
- OR Pipelines are placed in the same project
Yes, I have followed the docs and set Limit job authorization scope to current project for non-release pipelines OFF for the and project.
Yes, Project Collection Build Service has Read access to my repo and Queue Build permission to deploy pipeline.
Run Pipeline api docs
Am I doing anything wrong or is this a bug?