我在使用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
}
答案 0 :(得分:0)
像这样:
Write-Output (ls env:\$whatever | select-object -expandproperty value)