Create a vSphere Automation Session with User Credentials

With the vSphere Automation SDKs , you can create authenticated sessions by using only user credentials.

You connect to the vSphere Automation endpoint by using a user name and password known to the vCenter Single Sign-On service. The vSphere Automation uses your credentials to authenticate with the vCenter Single Sign-On Service and obtain a SAML token.

Prerequisites

  • Retrieve the vSphere Automation endpoint URL from the Lookup Service.

  • Verify that you have valid user credentials for the vCenter Single Sign-On identity store.

Procedure

  1. Create a connection stub by specifying the vSphere Automation endpoint URL and the message protocol to be used for the connection.
  2. Create a stub configuration instance and set the specific security context to be used.

    The security context object uses the user name and password that are used for authenticating to the vCenter Single Sign-On service.

  3. Create a Session stub that uses the stub configuration instance.
  4. Call the create operation on the Session stub to create an authenticated session to the vSphere Automation endpoint.

    The operation returns a session identifier.

  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

You can use the authenticated session to access vSphere Automation services. For more information about creating stubs to the vSphere Automation services, see Accessing vSphere Automation Services.