The steps in AzDOAPITools
After installing and setting up the module you need to create an object or array of objects of each pipeline which you want to convert.
Either create an array of names and run:
Depending on if you want to get your definition by its Unique ID or by its Name. If you don’t know the names of your Build Definitions you can run:
To have an array returned of all available Build Definition names used.
The result of either Get-AzDoAPIToolsDefinitionsTaskGroupsByNamesList or Get-AzDoAPIToolsDefinitionsTaskGroupsByID which in this example we set to $definitionstoconvert will be used in the next step to actually convert the pipeline to YAML
If you would inspect $definitionstoconvert you would see an array of PSObjects which contain metadata for AzDoAPITools to ingest the Azure DevOps REST API:
Next Step is to get the YAML syntax of the Definitions which you just pulled from REST API:
I am using Get-AzDoAPIToolsDefinitionAsYAMLPrepped to iterate over the definition get all the steps and properties and convert them into YAML syntax.
I’ve used -ExpandNestedTaskGroups to expand found Task Groups as single steps in the end YAML file. If ommitted it will refer to Task Groups as a template.
Furthermore I have supplied the -Outputasfile switch along with -Outputpath to indicate to the module that I want a YAML file created named after the Pipelines name “Example-Pipeline.yml” inside the path specified in -Outputpath. If the path does not exist you will be prompted to create it so make sure you have sufficient rights. If -Outputasfile is ommitted This function returns a PSObject with all YAMLPrepped build definition which can be used for later use in PowerShell (note this is not converted to YAML yet).