2

Trying to create a release pipeline programmatically, is it possible to export or clone an existing pipeline into yaml through PowerShell commands or something?

Attached screenshot from Azure DevOps:
Attached screenshot from Azure DevOps

Mathias R. Jessen
  • 157,619
  • 12
  • 148
  • 206
Vivek
  • 21
  • 3

2 Answers2

0

You can try to do this with the REST API:

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.

Yan Sklyarenko
  • 31,557
  • 24
  • 104
  • 139
0

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

Leo Liu
  • 71,098
  • 10
  • 114
  • 135