Search code examples
vmwarepowercli

Unable to connect to vCloud Server because of authorization error


I'm running the below command to connect to vCloud Director using PowerShell

Connect-CIServer -Server "company.com.au" -User "username" -Password "password" -Org "testorg"

However, it is giving me error like below:

Connect-CIServer : 20/09/2019 2:13:12 PM  Connect-CIServer
Unable to connect to vCloud Server 'https://company.com.au:443/api/'. The
server returned the following: Unauthorized: ''.
At line:1 char:1
+ Connect-CIServer -Server "company.com.au" -User "username" -Pas ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Connect-CIServer], CIException
    + FullyQualifiedErrorId : Cloud_ConnectivityServiceImpl_ConnectCloudServer_ConnectError,VMware.VimAutomation.Cloud.Commands.Cmdlets.ConnectCIServer

Unfortunately, not much information is given, I can login to the UI by the same credentials but not on command line?

I had similar issue when I was trying to login to VCentre, I got it working by ignoring certificates. Not sure if for VCloud Server,I am facing same issue?

Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false

Solution

  • Works well when I drop -Org parameter! so the command which worked for me to login to Cloud Director is as below:

    Connect-CIServer -Server "company.com.au" -User "username" -Password "password"