Since I am reusing the same pipeline YAML file in many projects, I need a method which does not require unnecessary GUI interaction when creating the pipeline.
Luckily, it is possible and the second link in the answer of Kontekst describes this. For convenience, I am providing an example here as well. The following
parameters:
- name: BuildType
displayName: Build type
type: string
default: development
values:
- experimental
- development
- release
When starting the pipeline from the DevOps GUI, the above definitions will cause that the variable display name ("Build type") is displayed with a bullet selection where the value can be chosen. The default (in this case "development") will be selected initially.
If the pipeline if started automatically (a commit trigger), then the defined variables will have their default values.
The value of parameters is accessed in the pipeline like normal pipeline variables, i.e. in this case by $(BuildType).