[英]Assign Azure Powershell variable to DevOps Pipeline variable
You should use logging command if you want to assign powershell variable to Azure DevOps variable如果要将 powershell 变量分配给 Azure DevOps 变量,则应使用日志记录命令
echo "##vso[task.setvariable variable=pipeline_ip;]$NewIP"
Update after clarification:澄清后更新:
If you use syntax like:如果您使用如下语法:
$NewIP = $(pipeline_ip)
Then $(pipeline_ip)
would be replaced with the value before script will be executed. $NewIP = $(pipeline_ip)
然后$(pipeline_ip)
将被替换为执行脚本之前的值。
And if you use syntax like如果你使用类似的语法
$NewIP = $env:PIPELINE_IP
then you will refer to environment variable and since all DevOps variables are mapped (except secret variables - here you need to express this excplicitly) it would also work. $NewIP = $env:PIPELINE_IP
然后您将引用环境变量,并且由于所有 DevOps 变量都已映射(秘密变量除外 - 在这里您需要明确表达)它也可以工作。
However, these are two ways of doing that.但是,这是这样做的两种方法。
You can use two methods:您可以使用两种方法:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.