'AzureDevOps: A task to trigger a release pipeline from YAML

We have a classic release pipeline that we'd like to be able to trigger from a YAML build pipeline under certain conditions, these conditions aren't always going to be ones we can define using the existing CI trigger that can be defined for a release pipelines. We'd also prefer not to use a multi-stage pipeline as the access controls for the release pipeline wouldn't be easy to replicate for YAML files.

With that in mind is there a task that can be used in a YAML build pipeline in order to "manually" trigger a classic release pipeline? This obviously could be achieved via the Azure DevOps API but it would be a lot easier if a task was available.



Solution 1:[1]

Based on your requirement, there is no built-in task can trigger release pipeline in Build Pipeline.

I suggest that you can use the Release Orchestrator task from Release Orchestrator.

Then you can use the task in YAML pipeline to trigger the release pipeline.

For example:

- task: releaseorchestrator@2
  displayName: 'Release Orchestrator'
  inputs:
    projectName: 123
    definitionName: 'New release pipeline'
    definitionStage: 'Stage 1'
    artifactVersion: test
    artifactTag: 1

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kevin Lu-MSFT