PowerCLI-Example-Scripts icon indicating copy to clipboard operation
PowerCLI-Example-Scripts copied to clipboard

Use the correct username else it does not work

Open JDMils opened this issue 5 years ago • 0 comments

We log into our vCD environment using our domain credentials however our OVDCs use local accounts as they belong to customers. I was getting the following error when the script was logging into the vCD environment:

Connect-CIServer : 19/02/2020 7:32:00 PM Connect-CIServer POST request for 'https://myvCDEnvironment.domain.com/api/sessions' resulted in 401 - Unauthorized ( Unauthorized). At C:\user\Get-VCDTenantReport.ps1:87 char:18

  • ... $Trash = Connect-CIServer -Server $Server -Org $Org -ErrorAction S ...
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [Connect-CIServer], CIException
    • FullyQualifiedErrorId : Cloud_ConnectivityServiceImpl_ConnectCloudServer_ConnectError,VMware.VimAutomation.Cloud.Commands.Cmdlets.ConnectCIServer

I found that I had to create a user in the OVDC tenancy first and then use that to logon and the script worked.

JDMils avatar Feb 19 '20 08:02 JDMils