Connect to a vCenter Server System by Using an OAuth 2.0 Authentication

If the vCenter Server system has an OpenID authentication enabled, you can authenticate with the vCenter Server system by using an OAuth security context for the VMware Cloud services platform.

Prerequisites

Use the VMware Cloud service web portal to generate an API token for authentication with PowerCLI.

Procedure

  1. Create an OAuth security context for the VMware Cloud service by using an API token.
    $oauthSecContext = New-VcsOAuthSecurityContext -ApiToken "Your API token" 
  2. Exchange the OAuth security context for an SAML security context.
    $samlSecContext = New-VISamlSecurityContext -VCenterServer "vCenter Server FQDN" -OAuthSecurityContext $oauthSecContext 
  3. Connect to a vCenter Server system by using an SAML security context.
    Connect-VIServer -Server "vCenter Server FQDN" -SamlSecurityContext $samlSecContext