I am attempting to read an Azure DevOps secret variable from a Powershell pipeline script. The variable looks like this within Azure:
I've attempted to access the secret variable both as a param such as
[CmdletBinding()]
Param (
$SecurePassword = $env:Password
)
and simply as an environment variable such as
$SecurePassword = $env:Password
Unfortunately the variable continues to appear null using either method.
I have no issue accessing non-secret variables. Any help would be greatly appreciated.
---------------------------------------- EDIT ----------------------------------------
I found documentation here stating that secrets are available to scripts within the pipeline if explicitly mapped in the environment section of the task.
I've updated my Powershell task and attempted to map the variable as both $(Password) and Password without any luck.
Mapping $(Password) as above reveals the string hidden behind asterisks.






