【发布时间】:2020-06-16 13:00:50
【问题描述】:
我有这个 PowerShell 脚本,它读取一些环境变量并输出它们:
Write-Host "name: $(tenantName) version: $(versionRelease) url: $(urlApplication)"
这些变量被定义为管道变量,也在 Azure DevOps 发布管道中的变量组中。
当在定义为 Inline 的 PowerShell task 内运行时,此脚本按预期工作。但是,当使用 文件路径 配置 PowerShell 任务时,完全相同的脚本将无法工作。在这种情况下,找不到tenantName env 变量:
tenantName : The term 'tenantName' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
有没有办法让环境变量对“文件”脚本可用,就像它们对“内联”脚本一样?
【问题讨论】:
标签: powershell azure-devops environment-variables