powershell - Azure DevOps发布管道-在括号内使用Powershell和管道变量

标签 powershell azure-devops azure-pipelines azure-pipelines-release-pipeline

我陷入了一些语法梦night,到目前为止,我尝试过的一切都无法正常工作。

它只有一行...在我使用$(env:name-of-var)来处理某些Release Pipeline变量之前,它绝对可以正常工作...

$primarykey = (Get-AzRelayKey -ResourceGroupName $($env:az-resourcegroupname) -Namespace $($env:az-relaynamespace) -HybridConnection $($env:AF.actionResultRelayConnectionName) -Name $($env:AF.actionResultFalloverRelayKeyName) | Select-Object -ExpandProperty PrimaryKey)

任何想法都收到了。提前致谢。

最佳答案

因为您在变量名中包含-,所以出现了错误。

您可以通过这种方式(安装$($env:az-...))来实现:

${env:az-resourcegroupname}
${env:az-relaynamespace}

关于powershell - Azure DevOps发布管道-在括号内使用Powershell和管道变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57078650/

相关文章:

powershell - 如何阻止Powershell坚持参数中的一个破折号?

powershell - powershell -split ('')指定一个新行

c# - Azure Pipelines 选项内部版本号 : Does $(Rev:r) increment on every build?

azure-devops - 使用 REST API 添加/删除管道检查

powershell - select-xml 不返回任何结果

azure-devops - 在敏捷过程中将 "Removed"状态添加到 Azure DevOps 错误的影响

azure-devops - 当所有测试通过时,Azure DevOps Build Pipeline 中的 Chutzpah Jasmine 测试返回失败

.net-core - NU1100 : Unable to resolve 'System.Reflection.TypeExtensions (>= 4.5.1)' for '.NETStandard,Version=v1.3'

Azure Devops YAML Pipeline 触发器不会为带有正斜杠的分支触发

powershell - 如何使用 PowerShell 合并/ 'flatten' 文件夹结构 - 递归