Trying to create a release pipeline programmatically, is it possible to export or clone an existing pipeline into yaml through PowerShell commands or something?
2 Answers
You can try to do this with the REST API:
- the GET request should bring you the JSON representation of the pipeline definition
- its 'configuration' property is of type Pipeline Configuration
- copy the 'configuration' part of the response, modify as needed for a new pipeline, and feed the result as an input to the POST request
It seems that the whole process can be wrapped in a PowerShell script. I don't have the env at hand to try this out and send you the exact snippets, but hope you get the idea.

- 31,557
- 24
- 104
- 139
is it possible to export or clone an existing pipeline into yaml through PowerShell commands or something?
For the Release pipeline, I am afraid you could not export or clone an existing Release pipeline into yaml through PowerShell commands or something. That because MS provide the Multi-stage YAML pipelines for CI and CD, So, there is no separate YAML mode for release pipeline. We could not export or clone an existing pipeline into yaml for release pipeline.
For the Build pipeline, we could use the REST API Yaml - Get to get the YAML for the build pipeline:
GET https://dev.azure.com/{organization}/{project}/_apis/build/definitions/{definitionId}/yaml?api-version=6.1-preview.1
And how to use the YAML to create a new build pipeline, you could refer below thread:
Azure DevOps create build definition via REST API given existing YAML

- 71,098
- 10
- 114
- 135