0

I am trying to pass PowerShell variable to an Azure Devops variable in pipeline during runtime but unable to pass them successfully. Could someone guide the correct syntax to apply escape sequence?

Azure devops pipeline variable:-

foo_ABC = abcdefghigklmnopqrstxyz
env= abc

Powershell task in pipeline:-

$environment=  "$(env)".ToUpper()

$temp= "foo_$($environment)"

Write-Output "$($temp)"

Output:-

Expected: abcdefghigklmnopqrstxyz

Actual: (foo_ABC)
1
  • Did you look at the documentation for how Azure DevOps variables are treated in scripts? Hint: It's an environment variable. Commented Apr 20, 2021 at 14:48

1 Answer 1

1

For this issue , the value of nested variables (like $($temp) are not yet supported in the pipelines. You can refer to this case to see this point.

As a workaround, you can try to use the Variable Toolbox task.

enter image description here

enter image description here enter image description here

You can refer to this case for this task.

Sign up to request clarification or add additional context in comments.

Comments

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.