How can you use secret variables from a linked variable group in an Azure Powershell task in an Azure Release pipeline?

牧云@^-^@ 提交于 2020-12-07 06:39:25

问题


I have an Azure Release pipeline that I've built using the GUI in Azure DevOps. There is a stage that has a linked variable group (Release scope) with a secret variable in the variable group. The stage has an agent job with an Azure Powershell task that runs a script file. That script file references the secret variable using the syntax $env:MYSECRETVARIABLE but the value is null. When I add an Azure Powershell task for debugging that runs Get-ChildItem -Path Env:\, I can see that all the non-secret variables in the variable group are mapped but the secret variable is not. What am I doing wrong here?


回答1:


I tested to get the secret variable in the variable group in azure powershell task, just use the syntax of $(varibaleName) to work.

Test with inline script:

Test with Script File:



来源:https://stackoverflow.com/questions/63143746/how-can-you-use-secret-variables-from-a-linked-variable-group-in-an-azure-powers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!