PowerCLI

 View Only
  • 1.  Error while connecting to vRA 8.x- Invoke-RestMethod - Could not establish trust relationship for the SSL/TLS secure channel.

    Posted Oct 08, 2020 06:47 AM

    Error while authenticating to vRA 8.x. How to eliminate Tls error ?

    Invoke-RestMethod : The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

    + $response = Invoke-RestMethod -Uri $url -Method Post -Headers $header ...

    +             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException

        + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand

    Please find the error screenshot

    Any help would be appreciated



  • 2.  RE: Error while connecting to vRA 8.x- Invoke-RestMethod - Could not establish trust relationship for the SSL/TLS secure channel.

    Posted Oct 08, 2020 06:52 AM

    Did you already try running the following before calling Invoke-RestMethod?

    [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls,

         [System.Net.SecurityProtocolType]::Tls11,

         [System.Net.SecurityProtocolType]::Tls12



  • 3.  RE: Error while connecting to vRA 8.x- Invoke-RestMethod - Could not establish trust relationship for the SSL/TLS secure channel.

    Posted Oct 08, 2020 07:12 AM

    Yes, I am still facing the same issue.

    Invoke-RestMethod : The underlying connection was closed: Could not establish trust relationship for the SSL/TLS

    secure channel.

    At line:1 char:2

    +  Invoke-RestMethod -Uri $url -Method Post -Headers $headers -Body $bo ...

    +  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc

       eption

        + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand



  • 4.  RE: Error while connecting to vRA 8.x- Invoke-RestMethod - Could not establish trust relationship for the SSL/TLS secure channel.

    Posted Oct 08, 2020 07:15 AM

    What does Get-PowerCLIConfiguration return?



  • 5.  RE: Error while connecting to vRA 8.x- Invoke-RestMethod - Could not establish trust relationship for the SSL/TLS secure channel.

    Posted Oct 08, 2020 07:19 AM

    Please find the output



  • 6.  RE: Error while connecting to vRA 8.x- Invoke-RestMethod - Could not establish trust relationship for the SSL/TLS secure channel.
    Best Answer

    Posted Oct 08, 2020 07:32 AM

    That seems to be ok.

    Out of curiosity, did you already try with the Connect-vRAServer function from the PowervRA module?



  • 7.  RE: Error while connecting to vRA 8.x- Invoke-RestMethod - Could not establish trust relationship for the SSL/TLS secure channel.

    Posted Nov 24, 2020 07:58 PM

    I'm getting the same error with Powervra 4.1.1



  • 8.  RE: Error while connecting to vRA 8.x- Invoke-RestMethod - Could not establish trust relationship for the SSL/TLS secure channel.

    Posted Nov 24, 2020 08:02 PM

    Since PowervRA is not part of PowerCLI but a community project, I suggest you open an Issue at the PowervRA repo.