Copy an existing pipeline

The easiest way is to clone existing pipeline through Azure DevOps portal. Click on Pipelines -> Your pipeline à Click the ellipse in the upper right corner (three vertical dots), then click clone.

If clone is not available due to any reason, you can create a new pipeline based on an existing yaml file which is basically cloning.

Pipelines -> New Pipeline -> Configure (3rd page of the wizard) -> Select “Existing Azure Pipelines YAML file”.

Here you can select the branch and the file you want to use. However, this does not copy the variables set in the pipelines.

Above solution will work within same project. If you want to clone/import pipeline from a different project, Select “Export to YAML” from source project pipeline. This will download a YAML file on your local. Open file, make changes and import to your new project repo.

Resources

https://docs.microsoft.com/en-us/azure/devops/pipelines/create-first-pipeline?view=azure-devops&tabs=java%2Ctfs-2018-2%2Cbrowser#clone-a-pipeline

https://stackoverflow.com/questions/57827447/is-there-a-way-to-clone-or-copy-an-existing-ci-cd-pipeline-in-azure-devops