How to pass PowerShell task argument to secure string param in PowerShell file

%3CLINGO-SUB%20id%3D%22lingo-sub-3300838%22%20slang%3D%22en-US%22%3EHow%20to%20pass%20PowerShell%20task%20argument%20to%20secure%20string%20param%20in%20PowerShell%20file%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3300838%22%20slang%3D%22en-US%22%3E%3CP%3EIs%20it%20possible%20to%20pass%20a%20parameter%20as%20a%20SecureString%20from%20a%20PowerShell%20task%20in%20Azure%20DevOps%20into%20params%20list%20in%20a%20PowerShell%20file%20called%20from%20pipeline%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EAzureDevOps%20PowerShell%20Tasks%20Arguments%3CBR%20%2F%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3E-windowstyle%20hidden%20-MyPass%20%24(pass)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3EPowerShell%20file%20called%20by%20task%20in%20pipeline%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3Eparam(%5BSecureString%5D%20%24MyPass)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHere's%20an%20%3CA%20href%3D%22https%3A%2F%2Fimgur.com%2Fa%2FcegUITa%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Eillustration%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Contributor

Is it possible to pass a parameter as a SecureString from a PowerShell task in Azure DevOps into params list in a PowerShell file called from pipeline?

 

AzureDevOps PowerShell Tasks Arguments

 

-windowstyle hidden -MyPass $(pass)

 

 

 

PowerShell file called by task in pipeline

 

param([SecureString] $MyPass)

 

 

Here's an illustration

0 Replies