Learner
Learner

Reputation: 511

Powershell variable over azure devops variable

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)

Upvotes: 0

Views: 222

Answers (1)

Hugh Lin
Hugh Lin

Reputation: 19491

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.

Upvotes: 1

Related Questions