Skip to content

Instantly share code, notes, and snippets.

@asizikov
Last active September 15, 2020 15:28
Show Gist options
  • Save asizikov/ffc613e4b81189545accd87212ace55c to your computer and use it in GitHub Desktop.
Save asizikov/ffc613e4b81189545accd87212ace55c to your computer and use it in GitHub Desktop.
save az cli output as var and use it later
jobs:
- job:
displayName: Your job
variables:
var-name: 'unknown'
steps:
- task: AzureCLI@2
inputs:
azureSubscription: 'sp-connection-name'
scriptType: 'pscore'
scriptLocation: 'inlineScript'
inlineScript: |
$tmp= & az blah-blah-blah -o tsv
Write-Output("##vso[task.setvariable variable=var-name;]$tmp")
- script: |
echo $(var-name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment