When you are importing virtual machines from vCenter Server, or when you are synchronizing catalogs that have external subscriptions, the password properties values of the imported virtual machines are removed for security reasons. To configure a password of an imported virtual machine, you can update the producSection element of the virtual machine.

Synchronizing a vApp template from an externally published catalog imports an identical copy of the vApp template to the subscriber side, but the password properties values, if any, are removed. Importing a virtual machine from vCenter Server also removes any password properties values. After the import you can use the VMware Cloud Director API to configure the password of the virtual machine.

You configure the password once. Further catalog synchronisations keep the configured password.

Procedure

  1. Retrieve an XML representation of the virtual machine.
    Use a request like this one:
    GET https://vcloud.example.com/api/vAppTemplate/vm-33
  2. Retrieve a list of the ProductSection elements of the virtual machine.
    Use a request like this one:
    GET https://vcloud.example.com/api/vAppTemplate/vm-33/producSections
    The response contains a ProductSectionList element.
  3. Copy and modify the retrieved ProductSectionList by adding the password value in the Property element.
  4. PUT the ProductSectionList element that you modified in Step 3 to the producSection element of the virtual machine.
    PUT https://vcloud.example.com/api/vAppTemplate/vm-33/producSections

Example: Configure the Password of an Imported Virtual Machine

Request:
PUT https://vcloud.example.com/api/vAppTemplate/vm-32/producSections
Content-Type: application/*+xml;version=31.0
...
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ProductSectionList
...
   <ovf:ProductSection ovf:class="" ovf:instance="" ovf:required="true">
        <ovf:Info>Information about the installed software</ovf:Info>
        <ovf:Property
         ovf:key="Password_Label"
         ovf:password="true"
         ovf:qualifiers="MinLen(1)"
         ovf:type="string"
         ovf:userConfigurable="true"
         ovf:value="My_Password">
            <ovf:Label>Password Label</ovf:Label>
        </ovf:Property>
   </ovf:ProductSection>
</ProductSectionList>
Response:
202 Status Code (The task that makes the change to the product section is passed back)
Content-Type: application/*+xml;version=31.0
...
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Task
   xmlns="http://www.vmware.com/vcloud/v1.5"
   ...
   operationName="templateUpdateVm"
   ...
   type="application/vnd.vmware.vcloud.task+xml">
   ...
</Task>