Retrieving password using locker API in VCF 9.0 for Management Components
- Arun Nukula
- Sep 12
- 1 min read
Retrieving Password from Locker
Step 1: Generate API Token
To generate an API token, you can use either the VCF Operations Fleet Management appliance logging into the shell as a root user or any Base64 encoding tool.
Encode your credentials in the following format:
echo 'admin@local:youradminatlocalpassword' | base64
Copy the resulting Base64-encoded string. This will be used for authorization.
Step 2: Authenticate via Swagger UI
Open the API documentation in your browser:Â
https://<vcf-operations-fleet-mgmt>/api/swagger-ui/index.htmlNavigate to VCF Operations → Developer Central → Fleet Management API → API Documentation.
In the Swagger UI, locate the API Token section. When prompted for authorization, enter the following format in the input field:
Basic <Base64-encoded credentials>Â Replace <Base64-encoded credentials>Â with the string you copied in Step 1.
Click Authorize to authenticate and begin executing API requests.
Step 3: Retrieve Passwords from Locker
Firstly let’s retrieve all passwords from the locker. So that we can use leverage the VMID out of the response and then retrieve specific password
           GET https://vcf-operations-fleetmanagement-appliance-fqdn/lcm/locker/api/passwordsAbove API will return response with the paginated list of passwords
[
  {
    "alias": "Default Password for vCenters",
    "createdOn": 1605791587373,
    "lastUpdatedOn": 1605791587373,
    "password": "PASSWORD****",
    "passwordDescription": "This password is being used for all my vCenters",
    "principal": "string",
    "referenced": true,
    "tenant": "string",
    "transactionId": "string",
    "userName": "administrator@vsphere.local",
    "vmid": "6c9fca27-678d-4e79-9a0f-5f690735e67c"
  }
]
Now retrieve the password by using the root password of VCF Operations fleet management appliance. Fetch the VMID of the password from theÂ
The Body should be
{\"rootPassword\":\"V*********!\"}The response of the previous call will retrieve the password needed.

