pooya13
pooya13

Reputation: 2711

How to choose from a selection when running Azure YAML pipeline

When running a YAML pipeline you can select the branch/tag where the YAML is defined. I was wondering if there is a way to have the same thing with an enum type custom variable for your pipeline? For example I want the user to be able to choose which region to deploy to in a release pipeline:

region:

But I don't want to have a plain string variable where the user might enter some bogus region causing issues during pipeline execution.

Is this supported with current Azure YAML pipelines? If not any ideas if there is an existing feature request one can vote for?

Upvotes: 0

Views: 1860

Answers (1)

pooya13
pooya13

Reputation: 2711

It seems that variables is not the right choice here. I should use runtime parameters like so:

parameters:
- name: region
  displayName: Deployment Region
  type: string
  default:
  values:
  - AMER
  - APAC
  - EMEA

As Vince pointed out, in order to enforce the user to explicitly choose an option you can leave the default blank.

Upvotes: 2

Related Questions