I have a few YAML file already hosted on devops repo. Is there any way to automatically create devops pipeline from these YAML file and not go through the wizard of setting up the pipeline.
This situation will also arise while setting up a new repo. I'm setting up tenancy for my platform and need to automatically setup a few pipelines when i bootstrap the repo.
Don't want to go through the below wizard to setup the pipeline:
You can automate it with Rest API. Use the Pipelines - Create:
POST https://dev.azure.com/{organization}/{project}/_apis/pipelines?api-version=7.1-preview.1
An example to body:
$body = @{
configuration=@{
variables=@{
customVariable=@{
value="value"
}
};
path="azure-pipelines.yml";
repository=@{
id= "repository-id";
name="repository-name"
type= "azureReposGit"
};
type= "yaml"
};
name= "pipeline-name";
folder= "\\"
}