PowerCLI-Created Tag Categories Prevent Host Tag Assignment Due to Invalid Associable Types
search cancel

PowerCLI-Created Tag Categories Prevent Host Tag Assignment Due to Invalid Associable Types

book

Article ID: 418652

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

  • Administrators using PowerCLI to automate tag and tag category creation in vCenter may encounter issues where tags cannot be assigned to intended objects, such as hosts or VMs.
  • Specifically, tag categories might display associable entities as "fieldType.Host" or "fieldType.Template", resulting in validation failures when attempting to add tags to their respective objects.

  • The problem manifests when tag categories created by automation scripts use illegal or unsupported associable types, leaving tags unusable for expected resources.

Environment

VMware vCenter Server 8.x

VMware vCenter Server 7.x

Cause

  • PowerCLI or similar automation scripts may set tag category associable entities using incorrect values such as "fieldType.Host" or "fieldType.Template".
  • VMware vCenter expects associable objects to be referenced using valid URIs, such as "urn:vim25:HostSystem", "urn:vim25:VirtualMachine".
  • Tags categorised under improperly set entities (illegal types) cannot be mapped correctly in vCenter, causing assignment failures and preventing proper tag-object associations.

Resolution

Ensure to take proper snapshot of the vCenter Server before proceeding. Refer: Snapshot Best practices for vCenter Server Virtual Machines

To correct illegal associable entity types set in a tag category:

  1. Use ldapmodify to replace illegal associable types with supported URIs in the vCenter LDAP directory.

For example, update vmwTaggingCategoryAssociableType: fieldType.Host to vmwTaggingCategoryAssociableType: urn:vim25:HostSystem.

     2. Example command (run on the vCenter appliance):

/opt/likewise/bin/ldapmodify -h localhost -p 389 -x -D "cn=administrator,cn=users,dc=vsphere,dc=local" -W << EOF
dn: cn=urn:vmomi:InventoryServiceCategory:<CategoryGUID>:GLOBAL,cn=urn:vmomi:InventoryServiceScope:default-scope:GLOBAL,cn=Tagging,cn=Services,dc=vsphere,dc=local
Changetype: Modify
Replace: vmwTaggingCategoryAssociableType
vmwTaggingCategoryAssociableType: urn:vim25:HostSystem
EOF

     3. After modifying the LDAP entry, restart the vpxd-svcs service on the vCenter to apply changes: service-control --restart vpxd-svcs

     4. Use the vSphere Client or ldapadd to verify/update associable types on tag categories as desired.

/opt/likewise/bin/ldapmodify -h localhost -p 389 -x -D "cn=administrator,cn=users,dc=vsphere,dc=local" -W << EOF
dn: cn=urn:vmomi:InventoryServiceCategory:<CategoryGUID>:GLOBAL,cn=urn:vmomi:InventoryServiceScope:default-scope:GLOBAL,cn=Tagging,cn=Services,dc=vsphere,dc=local
Changetype: add
Replace: vmwTaggingCategoryAssociableType
vmwTaggingCategoryAssociableType: urn:vim25:HostSystem
vmwTaggingCategoryAssociableType: urn:vim25:VirtualMachine
EOF

      5. Once corrected, tags under the category can be successfully added to hosts, VMs, or templates as intended.

Additional Information

  • By ensuring all tag categories reference valid VMware object types, you restore expected functionality for tag assignment and management in vSphere environments.
  • Automated or scripted category creation should follow documented URI requirements for associable types.