Force a user to enter a variable in the UI before running a pipeline in Azure Dev Ops

Viewed 741

I have an existing YAML Azure Dev Ops Pipeline.

In order to build/ deploy a new release, users have to press the Run Pipeline button in Azure Dev Ops.

enter image description here

Which brings up the following menu:

enter image description here

I would, at this point, like to ask the user to set the value of a variable. enter image description here

Something to prompt them & prevent them from proceeding. Is that possible to do via a YAML pipeline? If so, how can I achieve this?

The idea is for me to ask the user for an input before allowing them to proceed & create a new build etc. as there is a build step which relies on said variable to be set prior to build.

1 Answers

I don't think you can make a variable as mandatory, but as you said, you can add a simple step to check if the user is put some value:

- task: PowerShell@2
  inputs:
    targetType: 'inline'
    script: |
      if($env:testVariable -eq "")
      {
          Write-Error "testVariable variable is empty!"
      }
Related