azure-devopsazure-pipelinesazure-cli

Az CLI: Cannot run pipeline with runtime parameters


I'm trying to run a pipeline using AZ CLI. I have a simple pipeline:

parameters:
- name: initials
  displayName: Initials
  type: string

trigger:
- master

pool:
  vmImage: ubuntu-latest

steps:
- script: echo ${{ parameters.initials }}
  displayName: Test

And I try to run it using:

az pipelines run --organization <my org> --project <my project> --name <pipeline> --branch <my branch> --debug --variables initials=maim

Then I end up with an error:

ValidationResults":[{“result”:“error”,“message”:"A value for the parameter must be provided

Which is a bit odd since you can tell from the debug that the parameter is being set:

Debug output


Solution

  • It because you need to send parameters and you send variables.

    According to this GitHub issue it fixed in a new version:

    1. Need to remove old package first:
    az extension remove -n azure-devops
    az extension add --source https://github.com/roshan-sy/release-repo/releases/download/1/azure_devops-0.23.0-py2.py3-none-any.whl
    
    1. Initial test looks good:
    az login
    az pipelines run --help
    ...
    --parameters : Space separated "name=value" pairs for the parameters you would like to set.
    ...
    az pipelines run --name "{pipeline.name}" --parameters Param1={Value1}