azure devops - extracting secret from the pipeline
secret in azure devops are often masked and not accessible. I used to be able to extract it by dumping it into a file and then expose the value of the file.
Anyways, to extract secret, you can use the following code. Just ensure you have assigned the actual value to the $secret below :-
from https://stackoverflow.com/questions/68320361/get-azure-devops-secret-variable-as-plain-text-using-powershell
$secret = "fOoBaR"
Remove-Variable joined -Force -Confirm:$false -ErrorAction SilentlyContinue
for($i = 0; $i -lt $secret.Length; $i++){
if ($joined) {$joined = $($joined+" "+$($secret[$i]))}
else {$joined = $($secret[$i])}
}
Write-output "Secret: >$($joined)<"
Comments