Unified Authentication
Home Page Technical/How-To VCF Compute (vSphere)

Unified Authentication in VMware Cloud Foundation SDK 9.0: Seamless authentication across vSphere and vSAN APIs

VMware Cloud Foundation (VCF) 9 introduces a Unified VCF Software Development Kit (SDK) for Python and Java. The key highlight of this release was the unification of all the major components into a single deliverable package to deliver simple, extensible, and consistent automation experience across the stack. Currently, the following VCF components are included as a part of the unified VCF SDK and rest of the components will be made available very soon- 

  • VMware vSphere
  • VMware vSAN
  • VMware vSAN Data Protection
  • VMware SDDC Manager 

If you are reading the term Unified VCF SDK for the first time, do not worry about it. You can visit some of the existing content such as the announcement blog post or visit the VMware Explore Las Vegas 2025 session to get yourself up to speed with all the enhancements introduced with VCF APIs and the VCF SDK. 

In this blog post I will focus on a small yet very effective enhancement to our vSphere API authentication and explain its  usage across the vSphere and vSAN APIs.

Authentication dilemma with vSphere APIs

For context, VMware vSphere exposes two major categories of APIs: vSphere Web Services APIs and vSphere Automation APIs. The primary difference between the two lies in their underlying communication protocol.

If you have ever explored the Managed Object Browser (MOB) from the vSphere Client, you were interacting with the Web Services (SOAP) APIs. In contrast, the API Explorer in the Developer Center exposes the vSphere Automation (REST) APIs.

For building complete solutions, developers often need to work with both sets of APIs. Historically, this created an inconsistent experience because each API type required separate authentication with their own set of authentication API, which was inconsistent and cumbersome for anyone building workflows that spanned across vSphere Web Services, vSphere Automation, and even vSAN APIs.

The unified authentication

Starting with vSphere 8 Update 3, we have significantly improved the developer experience by introducing unified authentication across vSphere and vSAN API types. This enhancement is implemented in pyvmomi (the vSphere SDK for Python), where the vSAN SDK is now also merged.

With this update-

  • You can authenticate once using the vSphere Web Services APIs (SOAP) and reuse the same session ID with the vSphere Automation APIs (REST) and vSAN APIs.
  • The workflow also works in reverse—authenticate using Automation APIs, and reuse that session seamlessly with Web Services and vSAN APIs.

This unification eliminates the need for multiple login flows, delivering a far more consistent and simplified developer experience.

Even better, this improvement is not limited to the raw APIs. It is now also available across our SDKs, including the Unified VCF SDK 9.0 for Python and Java, giving developers a single, coherent authentication model across vSphere and vSAN APIs. 

Sample Code

This example shows how unified authentication works between the vSphere Web Services APIs (SOAP) and the vSphere Automation APIs (REST / vAPI) using pyvmomi and the vSphere Automation Python SDK.

  1. Connect once using Web Services (SOAP)
    The script first connects to vCenter using SmartConnect from pyVmomi. This is the traditional Web Services (WSDL/SOAP) connection that many vSphere admins and automation scripts already use.
  2. Do something with the Web Services APIs
    After connecting, we retrieve the vCenter “About” information and list all virtual machines using the classic Web Services API (RetrieveContent, CreateContainerView, etc.).
  3. Reuse the same session for REST (vAPI)
    Instead of logging in again, we extract the session ID from the Web Services connection:
    session_id = si._GetStub().GetSessionId()
  4. Reuse the vSphere Web Service API Session ID in vSphere Automation API
    We then pass this session_id into the create_vsphere_client() function. This allows the vSphere Automation (REST) client to reuse the same session that was created by the Web Services login.
  5. Call a vAPI (REST) endpoint
    With the vsphere_client created, we call:
    vsphere_client.vcenter.VM.list()
  6. This lists VMs using the vSphere Automation APIs (REST), but without performing a second login. The authentication is reused from vSphere Web Service API. 

This was just one of the examples of reusing vSphere Web Service API in vSphere Automation API. You can also do vice versa and reuse the vSphere Automation API Session ID in vSphere Web Service API. 

What is happening behind the scenes?

vmware-api-session-id is a shared key that both vSphere Web Service API (SOAP) and vSphere Automation API (REST) consume. Whichever side creates the session, the other side can use it with the vmware-api-session-id header. 

That is all for this blog post. Feel free to refer to additional resources on Unified VCF SDK and learn how we are delivering a simple, extensible, and consistent developer experience by introducing enhancements to our core APIs and SDKs. Stay tuned for more such information in the coming days. 

Resources


Discover more from VMware Cloud Foundation (VCF) Blog

Subscribe to get the latest posts sent to your email.