Programmatically Create Azure Pipelines
This script New-AzPipeline lets you programmatically create Azure Pipelines based on your folder structure.
It browses through your folder structure for pipeline.yml files and creates corresponding Azure Pipelines in Azure DevOps. It has several features like creating pipelines based on a specific folder/module version, latest version or just creates all. It also compares against existing Pipelines and skips these.
Script
The script New-AzPipeline.ps1 can be found here.
A newer version is in progress already and will be available soon. Check out our Scripts repository for any future updates.
Parameters
Mandatory
- OrganizationName (Azure DevOps Organization)
- ProjectName (Azure DevOps Project)
- RepositoryName (Azure DevOps Repository)
Optional
- FolderPath (Azure Pipelines folder path)
- Version (Pipeline versions to be used)
- PipelinePath (Local folder path to be browsed)
- Latest (Latest Pipeline versions to be created)
- All (All Pipeline versions to be created)
Usage
.\New-AzPipeline.ps1 -OrganizationName <OrganizationName> -ProjectName <ProjectName> -RepositoryName <RepositoryName> -Latest
Requirements
- Azure DevOps Login (az devops login) or Azure Login (az login / Connect-AzAccount)
- Azure DevOps Organization
- Azure DevOps Project
- Azure DevOps Repository
Permissions
Contributor (Azure DevOps)
Base Folder Structure
|
|
Based on this structure New-AzPipeline.ps1
recognizes
Module0
andModule1
as Pipeline names2020-04-20
as corresponding versions- Azure Pipelines based on
pipeline.yml
Impressions
Contributions
Thanks to @simonbms for helping me out with the object comparions in order to have only the latest folders picked for the -Latest
switch.