Problem with output variables in Self Hosted Agent

Copper Contributor



I have the following sample code that I implement using Azure DevOps pipelines and it works without problem, I can see the value of the SAUCE variable in all the tasks in my Job. Then I run it but using a self hosted Agent that I have in an Azure virtual machine and it doesn't work anymore, for some reason the value of the variable is lost. 

- job: TestOutputVars
        displayName: Test Output Variables
          - bash: |
              echo "##vso[task.setvariable variable=sauce;isOutput=true]crushed tomatoes"
              echo "my environment variable is $SAUCE"

          - bash: |
              echo "my environment variable is $SAUCE"

          - task: PowerShell@2
              targetType: "inline"
              script: |
                Write-Host "my environment variable is $env:SAUCE"
              pwsh: true

What could be the problem, or should I do some specific configuration in the virtual machine I am using as agent ?

0 Replies