How can I use a secret variable in my powershell script in my release definition?
I came across this but it doesn't work. The directory "$($env:AGENT_HOMEDIRECTORY)\agent\worker\Modules"
doesn't exist on the new agents.
What's the correct way of accessing a secret variable on new hosts? My agent version is 2.114.0.
By design, you have to pass the value of secret variable through PowerShell parameters.
For example:
Variable: password (secret)
task: PowerShell
Arguments: -pass $(password)
Script:
Param(
[String]$pass
)
if ($pass) { Write-Host "variable is NOT null" }
if (!$pass) { Write-Host "variable is null" }