For this issue , right now there is no way to automate the creation of classic release definition. You will need to create the definition and then you can queue a Release run using az pipelines release create
command.
The role of az pipelines release create
command is to kick off a new release for an existing release pipeline, not to create a new release pipeline.
You can refer to this issue on github about this.
So as a workaround , it is possible to automate the new yaml pipeline definitions with az pipelines create command which can constitute both build (CI) and release (CD).
First you can create a yaml file(e.g. azure-pipelines.yml) in the repo and set the definition for both CI and CD pipelines in the yaml file. YAML schema reference can give you guidance.
Then you can create an Azure Pipeline for a repository with the pipeline yaml already checked in into the repository via az pipeline create
command. Specify --yaml-path
in the command.
--yaml-path --yml-path :
Path of the pipelines yaml file in the repo (if yaml is already
present in the repo).