To establish a session with the vSphere Automation API Endpoint in the vCenter Server Appliance, you create a connection to the endpoint and authenticate with vCenter Single Sign-On credentials to receive a session ID.

To perform this task, you must have the following items in place:

The DNS name or IP address of the vCenter Server Appliance

A vCenter Single Sign-On domain account that has the requisite permissions for the operation that you intend to invoke

1

Create a connection context by specifying the vSphere Automation API Endpoint URL and the message protocol to be used for the connection.

2

Create the request options or stub configuration and set the specific security context to be used.

The security context contains the vCenter Single Sign-On user name and password that are used for authenticating to the vSphere Automation API Endpoint.

3

Create an interface stub or a REST path that uses the stub configuration.

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

Add the cookie to your request headers or to a security context for your client stub configuration.

6

Remove the basic authentication from your request headers or the security context of your client stub configuration.

Subsequent method calls authenticate with the session cookie instead of the user name and password.

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.