Skip to content
| Marketplace
Sign in
Azure DevOps>Azure Pipelines>setvar
setvar

setvar

riezebosch

|
185 installs
| (0) | Free
Set pipeline variables from stdout
Get it free

setvar

Build Status

Transform output from a tool into pipeline variables for your Azure Pipelines.

Instead of

- powershell: echo "##vso[task.setvariable variable=myOutputVar;isOutput=true]this is the value"

Just do

- task: setvar@0
- powershell: echo "this is the value" | setvar -name myOutputVar -isOutput

This mostly makes sense when the value is the output of another tool.

- task: setvar@0
- task: AzureCLI@1
  inputs:
    scriptLocation: inlineScript
    inlineScript: |+
      az image list '[0].name' -o tsv | setvar -name imageName -isOutput

Because now you don't have to worry anymore about how to capture output into a variable in the specific shell. This will make your script agent agnostic again!

The only required parameter is -name for the variable name. You can also specify the -isOutput and -isSecret flags to create an output and/or secret variable.

Only add the setvar task once in your pipeline to make it available on the agent.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft