azure-devopsazure-devops-pipelines

How can I prompt for variables when launching Azure DevOps pipelines?


I'm trying to get Azure DevOps pipelines to prompt for a version number when manually launching a pipeline (defined using the new YAML syntax).

Even when I define variables in the template, the launch screen says "This pipeline has no defined variables". How can I define variables so that they show up in the pipeline launch?

Current YAML definition contains:

variables:
  - name: versionName
    value: ''

These are not shown when launching the pipeline:

Running the pipeline


Solution

  • While Shayki's answer is correct for defining variables, what I was really looking for is runtime parameters.

    With the following YAML definition:

    parameters:
      - name: myParameter
        displayName: Description of myParameter
        default: defaultMyParameter
        type: string
    

    it prompts for the parameter value when launching the pipeline:

    Pipeline prompting for myParameter

    The parameter must be referenced in the template using ${{ parameters.myParameter }}, the other variable syntaxes don't work.