2

i have a branch in git with a .yaml build file which has a script to simply print out the value of the variable declared in the .yaml

if i run the command: az pipelines run --id 999 --variables "myvar=myvar" I expected the variable to change as I am injecting it. it doesnt.

am i misunderstanding what this switch does? if so, what is it supposed to do and/or how can i achieve my goal?

i tried i tried i dont understand these SO "quality standards" <= (this line allowed me to save the post)

Kam
  • 340
  • 2
  • 12
  • Did you get this working? I'm running into the same issue. I see the variable (parameter, really) being posted if I use `--debug` – Dylan Berry Feb 18 '21 at 20:23
  • @DylanBerry Sorry, I never did. I ending up changing my perspective on the solution. I started using variable groups instead. I am able to change what is in a variable group using the CLI (i think - it was a long time ago) - but even then I abandoned it as I found other ways of achieving what I wanted. – Kam Feb 20 '21 at 12:04
  • if you're interested, I used the rest api to get this working the way I wanted: https://github.com/Azure/azure-cli-extensions/issues/2974#issuecomment-782040239 – Dylan Berry Feb 20 '21 at 15:37
  • @DylanBerry Thanks for that. Very useful to know! – Kam Feb 21 '21 at 18:26

1 Answers1

-2

For az pipelines variable ,there are four commands

  • az pipelines variable create Add a variable to a pipeline.
  • az pipelines variable delete Delete a variable from pipeline.
  • az pipelines variable list List the variables in a pipeline.
  • az pipelines variable updateUpdate a variable in a pipeline.

You should use az pipelines variable update command to update a variable in a pipeline.

Command sample:

az pipelines variable update --name
PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • 2
    but what if these variables are in a .yaml file rather than the pipeline? the original question was really how do i make the "-variables" switch on the `az pipelines run` command work as I couldnt get it to do anything with a pipeline variable or with a .yaml variable. i have since managed to use multi stage .yml files to do something respectable and will be looking to use your idea by way of variable groups. I thin kyou are right and i should change a pipeline/group variable then trigger the pipeline with `run`. i will be back after i try this all, thanks – Kam Jun 30 '20 at 08:24