I am running into below error while trying to run this piece of code, can someone throw some light on what I am missing here? Thanks!
$SecurePassword = ConvertTo-SecureString "password" -AsPlainText -Force -ErrorAction Stop
$SSCred = New-Object System.Management.Automation.PSCredential ("PROD\username", $SecurePassword) -ErrorAction Stop
Write-Host "$(Get-date): Done Secret Server Login"
$AzureProdLock = Get-SecretServerCredential -SamAccountName pjob9001 -OperatorCredentials $SSCred -Verbose:$True -ErrorAction Stop
$Null = Connect-AzAccount -ServicePrincipal -Credential $AzureProdLock -Tenant "tenantId" -ErrorAction Stop -WarningAction SilentlyContinue
Error msg:
"Exception calling ".ctor" with "2" argument(s): "Cannot process argument because
the value of argument "userName" is not valid. Change the value of the "userName" argument and run the operation again.""