Pass Secret Variable from TFS Build to Powershell script Pass Secret Variable from TFS Build to Powershell script powershell powershell

Pass Secret Variable from TFS Build to Powershell script


Finally I managed to solve it.

I have put double quotes around my Password when sending it via the powershell script arguments. Boom!! it started working. It sends the decrypted password.

-UserName $(Username) -Password "$(Password)"

My power shell script stays the same as above.

 Param(    [Parameter(Mandatory=$true)]    [string]$UserName,    [Parameter(Mandatory=$true)]    [string]$Password)$appPool = New-WebAppPool -Name "test"$appPool.processModel.userName = $userName$appPool.processModel.password = $password$appPool.processModel.identityType = "SpecificUser"$appPool | Set-Item