To establish a vSphere Automation session, you create a connection to the vSphere Automation API endpoint and then you authenticate with a SAML token to create a session for the connection.

Prerequisites

  • Retrieve the vSphere Automation endpoint URL from the Lookup Service.
  • Obtain a SAML token from the vCenter Single Sign-On service.

Procedure

  1. Create a connection by specifying the vSphere Automation API endpoint URL and the message protocol to be used for the connection.
    Note: To transmit your requests securely, use https for the vSphere Automation API endpoint URL.
  2. Create the request options or stub configuration and set the security context to be used.
    The security context object contains the SAML token retrieved from the vCenter Single Sign-On service. Optionally, the security context might contain the private key of the client application.
  3. Create an interface stub or a REST path that uses the stub configuration instance.
    The interface stub corresponds to the interface containing the method to be invoked.
  4. Invoke the session create method.
    The service creates an authenticated session and returns a session identification cookie to the client.
  5. Create a security context instance and add the session ID to it.
  6. Update the stub configuration instance with the session security context.

What to do next

Use the updated stub configuration with the session ID to create a stub for the interface that you want to use. Method calls on the new stub use the session ID to authenticate.