VixDiskLib_Connect() connects the library to either a local VMware host or a remote server. For hosted disk on the local system, provide null values for most connection parameters. For managed disk on vSphere, specify virtual machine name, vCenter Server or ESXi host, user name, password, and port number.
vixError = VixDiskLib_Connect(&cnxParams, &srcConnection)
Always call VixDiskLib_Disconnect() before the end of your program.
Calling vixDiskLib_Disconnect() invalidates any open file handles, so if you use the VixMntapi library, call VixMntApi_CloseDiskSet() before calling disconnect.
You can opt to use the VixDiskLibSSPICreds connection parameter to enable Security Support Provider Interface (SSPI) authentication. SSPI has the advantage of not storing plain text passwords in configuration files or in the registry. In order to be able to use SSPI, the following conditions must be met:
- Connections must be made directly to a vCenter Server instance.
- Applications and their connections must employ one of two user account arrangements. The connection must be established either using the same user context with the same user name and password credentials on both the proxy and the vSphere Server, or using a domain user. Attempts by applications to establish connections using the Local System account context will fail.
- User contexts must have administrator privileges on the proxy and have VCB Backup User role assigned in vSphere (by the vCenter Server).
If your setup meets all these conditions, you can enable SSPI authentication by setting USERNAME to __sspi__. For SSPI, the password must be set, but it is ignored. It can be set to "" (null string).