We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm trying to figure how to use a "Secret" variable with the PowerShell++ Inline Script.
Is it possible ?
Here's what I tried so far.
The secret variable is named deploymentPassword
Write-Host "Encrypting the Password" $secpasswd = ConvertTo-SecureString $(deploymentPassword) -AsPlainText -Force
Write-Host "Creating the Credential Object" $cred = New-Object -TypeName "System.Management.Automation.PSCredential"( "TENANTDEV\SVC-TFS-DV-DEPLOY", $secpasswd )
I get this error: Encrypting the Password ##[error]Cannot process command because of one or more missing mandatory parameters: String.
Write-Host "Encrypting the Password" $secpasswd = ConvertTo-SecureString $(deploymentPassword) -Force
Import-Module "Microsoft.TeamFoundation.DistributedTask.Task.Internal"
Write-Host "Reading from TFS Variable" $password = Get-TaskVariable -Context $distributedTaskContext -Name "deploymentPassword"
Write-Host "Creating the Credential Object" $cred = New-Object -TypeName "System.Management.Automation.PSCredential"( "TENANTDEV\SVC-TFS-DV-DEPLOY", $password )
I get this error: Creating the Credential Object ##[error]Cannot find an overload for "PSCredential" and the argument count: "2".
Write-Host "Securing value" $secpasswd = ConvertTo-SecureString $(deploymentPassword) -AsPlainText -Force
I get this error: Securing value
##[error]Cannot process command because of one or more missing mandatory parameters: String.
The text was updated successfully, but these errors were encountered:
Found it… I was super close….. For the ConverTo-SecureString, I had to wrap the deploymentPassword with double quotes:
My suggestion is to add this to your Knowledge Base/Wiki/Readme.md for others.
Write-Host "Securing value" $secpasswd = ConvertTo-SecureString "$(deploymentPassword)" -AsPlainText -Force
Write-Host "Creating the Credential Object" $cred = New-Object -TypeName "System.Management.Automation.PSCredential"( "myDomain\myUser", $secpasswd )
Sorry, something went wrong.
No branches or pull requests
I'm trying to figure how to use a "Secret" variable with the PowerShell++ Inline Script.
Is it possible ?
Here's what I tried so far.
The secret variable is named deploymentPassword
Test 1:
Write-Host "Encrypting the Password"
$secpasswd = ConvertTo-SecureString $ (deploymentPassword) -AsPlainText -Force
Write-Host "Creating the Credential Object"
$cred = New-Object -TypeName "System.Management.Automation.PSCredential"( "TENANTDEV\SVC-TFS-DV-DEPLOY", $secpasswd )
I get this error:
Encrypting the Password
##[error]Cannot process command because of one or more missing mandatory parameters: String.
Test 2:
Write-Host "Encrypting the Password"
$secpasswd = ConvertTo-SecureString $ (deploymentPassword) -Force
Write-Host "Creating the Credential Object"
$cred = New-Object -TypeName "System.Management.Automation.PSCredential"( "TENANTDEV\SVC-TFS-DV-DEPLOY", $secpasswd )
I get this error:
Encrypting the Password
##[error]Cannot process command because of one or more missing mandatory parameters: String.
Test 3:
Import-Module "Microsoft.TeamFoundation.DistributedTask.Task.Internal"
Write-Host "Reading from TFS Variable"
$password = Get-TaskVariable -Context $distributedTaskContext -Name "deploymentPassword"
Write-Host "Creating the Credential Object"
$cred = New-Object -TypeName "System.Management.Automation.PSCredential"( "TENANTDEV\SVC-TFS-DV-DEPLOY", $password )
I get this error:
Creating the Credential Object
##[error]Cannot find an overload for "PSCredential" and the argument count: "2".
Test 4:
Import-Module "Microsoft.TeamFoundation.DistributedTask.Task.Internal"
Write-Host "Reading from TFS Variable"
$password = Get-TaskVariable -Context $distributedTaskContext -Name "deploymentPassword"
Write-Host "Securing value"
$secpasswd = ConvertTo-SecureString $ (deploymentPassword) -AsPlainText -Force
Write-Host "Creating the Credential Object"
$cred = New-Object -TypeName "System.Management.Automation.PSCredential"( "TENANTDEV\SVC-TFS-DV-DEPLOY", $secpasswd )
I get this error:
Securing value
##[error]Cannot process command because of one or more missing mandatory parameters: String.
The text was updated successfully, but these errors were encountered: