Azure托管代理管道扩展动态环境变量

时间:2019-09-28 16:40:13

标签: azure powershell

我在使用Azure Powershell任务在Azure Pipeline中扩展动态变量时遇到问题。我该如何获得$解析为https://whatever.com的任何金额?

Write-Host "##vso[task.setvariable variable=eus2-webAppName;]https://whatever.com";
[string[]] $regionsToSwap = "eus2".Split("|");

$regionsToSwap | ForEach-Object {
    $whatever = "$_-webappName";
    Write-Output $($whatever) # <-- Resolves to eus2-webAppName
}

1 个答案:

答案 0 :(得分:0)

像这样:

Write-Output (ls env:\$whatever | select-object -expandproperty value)