Previous Topic: Delete a Tag

Next Topic: Remove a Tag from a Managed Device

Tag a Managed Device

You can tag a managed device to add the machine to a security group and manage it remotely.

Follow these steps:

  1. Get the ID that CA Access Control for Virtual Environments uses for the managed device.

    To get the ID that CA Access Control for Virtual Environments uses for the managed device, use a REST request to retrieve the device details, using a filter. For example:

    https://hostname:18443/iam/api/1.0/restapi/environments/ac/devices?managed-object-vcenter-uuid=54E79C3A-49D5-4958-A983-8B919F470CEC&managed-object-id=vm-394
    

    Note: In the previous example, you pass as filtering parameters, the vCenter UUID and the VM UUID, as defined in the VMware Managed Object Browser (MOB).

    You get a response XML document back, similar to the following:

    <Devices>
      <Device>
        <ID>vm-19</ID>
        <ParentID>esx-3</ParentID>
        <Name>ESXi in a box</Name>
        <Type>VirtualMachine</Type>
        <VirtualMachineProperties>
          <ManagedObjectID>vm-394</ManagedObjectID>
          <ManagedObjectVCenterUUID>54E79C3A-49D5-4958-A983-8B919F470CEC</ManagedObjectVCenterUUID>
          <GuestOSVersion>LINUX_REDHAT_5</GuestOSVersion>
          <GuestOSArchitecture>X86</GuestOSArchitecture>
          <GuestOSDescription>Red Hat Enterprise Linux 5 (64-bit)</GuestOSDescription>
        </VirtualMachineProperties>
        <SecurityGroups>
          <SecurityGroup>
            <ID>sg-13</ID>
            <Name>weiig01esxi01.ca.com</Name>
            <Description/>
            <Owner>superadmin</Owner>
          </SecurityGroup>
          <SecurityGroup>
            <ID>sg-15</ID>
            <Name>Discovered virtual machine</Name>
            <Description/>
            <Owner>superadmin</Owner>
          </SecurityGroup>
          <SecurityGroup>
            <ID>sg-22</ID>
            <Name>vSphere in a box</Name>
            <Description/>
            <Owner>superadmin</Owner>
          </SecurityGroup>
        </SecurityGroups>
      </Device>
    </Devices>
    

    The ID of the device is vm-19 as specified in the response XML file.

  2. Update the device with the assigned tag.

    Send an HTTP PUT command to the following URL:

    https://<host>:18443/iam/api/1.0/restapi/environments/ac/devices/<managed_device_ID>
    

    Note: The HTTP content must contain all of the existing properties of the device in addition to the new assigned tag information. To get the existing properties, copy the data in between the <Device>…</Device> tags from the response XML file when you filtered for the CA Access Control for Virtual Environments ID of the device.

    An example of HTTP content with the new tag relationship:

    <Device>
      <ID>vm-19</ID>
      <ParentID>esx-3</ParentID>
      <Name>ESXi in a box</Name>
      <Type>VirtualMachine</Type>
      <VirtualMachineProperties>
        <ManagedObjectID>vm-394</ManagedObjectID>
        <ManagedObjectVCenterUUID>54E79C3A-49D5-4958-A983-8B919F470CEC</ManagedObjectVCenterUUID>
        <GuestOSVersion>LINUX_REDHAT_5</GuestOSVersion>
        <GuestOSArchitecture>X86</GuestOSArchitecture>
        <GuestOSDescription>Red Hat Enterprise Linux 5 (64-bit)</GuestOSDescription>
      </VirtualMachineProperties>
      <Tags>
        <Tag>
          <Name>testtag</Name>
          <Description>testtag2 description</Description>
        </Tag>
      </Tags>
      <SecurityGroups>
        <SecurityGroup>
          <ID>sg-13</ID>
          <Name>weiig01esxi01.ca.com</Name>
          <Description/>
          <Owner>superadmin</Owner>
        </SecurityGroup>
        <SecurityGroup>
          <ID>sg-15</ID>
          <Name>Discovered virtual machine</Name>
          <Description/>
          <Owner>superadmin</Owner>
        </SecurityGroup>
        <SecurityGroup>
          <ID>sg-22</ID>
          <Name>vSphere in a box</Name>
          <Description/>
          <Owner>superadmin</Owner>
        </SecurityGroup>
      </SecurityGroups>
    </Device>