Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Unable to process password variable in powershell because of special characters

$
0
0

Hi Team, I am working on a PS script to install VSTS agents on my Azure VMs through an Azure DevOps Release Pipeline.

Here in the below script, I am passing a Service Account Password, which is set by my customers. Below script fails whenever Password consist of special characters like

")';:( 
Code:

 .\config.cmd --deploymentgroup --deploymentgroupname DeployGroupSQL --agent $env:COMPUTERNAME

--runasservice

--windowsLogonAccount $(ServiceAccountUser)

--windowsLogonPassword "$(Service_Account_Password)" --work '_work'

--adddeploymentgrouptags --deploymentgrouptags $SQL

--url 'https://dev.azure.com/campusmgmt-product-development/'

--projectname 'Student' --auth PAT --token u4bq6j******************************bhhyq; 


I have tried putting whole password into double quotes as well as single quotes but of no help.

This Service Account Password is a Pipeline variable and hence needs to be passed like $(Service_Account_Password).

Can you please suggest on how can I deal with this situation. I have already tried putting this as a here-string, Secure-String, or script parameter but has not proved of any help.

Hoping to hear back soon as this is urgent for my project release.




Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>