Skip to main content
deleted 7 characters in body
Source Link
it3xl
  • 2.7k
  • 33
  • 40

Solution

$userName = 'test-domain\test-login' $password = 'test-password' $pwdSecureString = ConvertTo-SecureString -Force -AsPlainText $password $credential = New-Object -TypeName System.Management.Automation.PSCredential ` -ArgumentList $userName, $pwdSecureString 

For Build Machines
In the previous code replace user name and password values by secret ("hidden from logs") environment variables of your build-machine

Test results by adding

'# Results' $credential.GetNetworkCredential().Domain $credential.GetNetworkCredential().UserName $credential.GetNetworkCredential().Password 

and you'll see

# Results test-domain test-login test-password 

Solution

$userName = 'test-domain\test-login' $password = 'test-password' $pwdSecureString = ConvertTo-SecureString -Force -AsPlainText $password $credential = New-Object -TypeName System.Management.Automation.PSCredential ` -ArgumentList $userName, $pwdSecureString 

For Build Machines
In the previous code replace user name and password values by secret ("hidden from logs") environment variables of your build-machine

Test results by adding

'# Results' $credential.GetNetworkCredential().Domain $credential.GetNetworkCredential().UserName $credential.GetNetworkCredential().Password 

and you'll see

# Results test-domain test-login test-password 

Solution

$userName = 'test-domain\test-login' $password = 'test-password' $pwdSecureString = ConvertTo-SecureString -Force -AsPlainText $password $credential = New-Object -TypeName System.Management.Automation.PSCredential ` -ArgumentList $userName, $pwdSecureString 

For Build Machines
In the previous code replace user name and password values by secret ("hidden from logs") environment variables of your build-machine

Test results by

'# Results' $credential.GetNetworkCredential().Domain $credential.GetNetworkCredential().UserName $credential.GetNetworkCredential().Password 

and you'll see

# Results test-domain test-login test-password 
Source Link
it3xl
  • 2.7k
  • 33
  • 40

Solution

$userName = 'test-domain\test-login' $password = 'test-password' $pwdSecureString = ConvertTo-SecureString -Force -AsPlainText $password $credential = New-Object -TypeName System.Management.Automation.PSCredential ` -ArgumentList $userName, $pwdSecureString 

For Build Machines
In the previous code replace user name and password values by secret ("hidden from logs") environment variables of your build-machine

Test results by adding

'# Results' $credential.GetNetworkCredential().Domain $credential.GetNetworkCredential().UserName $credential.GetNetworkCredential().Password 

and you'll see

# Results test-domain test-login test-password