1

I have a variable defined in my Python script task in Azure pipelines.

variable = "True"

I want to use this variable in the next task which is a Powershell script task.

How can I achieve this using Azure YAML pipelines?

Thanks!

1 Answer 1

2

Have you looked at Task Output Variables already? e.g.

steps:
- task: PythonScript@0
  name: pythonTask
  inputs:
    scriptSource: 'inline'
    script: |
      someVar = "True"
      print("someVar = " + someVar)
      print("##vso[task.setvariable variable=someVar]" + someVar)

- task: PowerShell@2
  inputs:
    targetType: 'inline'
    script: |
      Write-Host "python var = $(someVar)"
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for your response @Killian! This was exactly what I wanted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.