A common question that I see frequently asked by customers is whether Custom Attributes in vCenter Server can be completely replaced by vSphere Tags? Both Custom Attributes and vSphere Tags provide metadata capabilities, but there are some underlying differences between the two and depending on how you use Custom Attributes today, you may or may not be able to completely migrate over to using vSphere Tags, at least in the short term.
UPDATE (11/16/16): vSphere 6.5 now allows you to fully view and manage Custom Attributes directly from the vSphere Web Client.
Custom Attributes allows you to specify custom "keys" associated with either a Virtual Machine or an ESXi host object using the vSphere C# Client. which are the only supported objects When using the vSphere API, you can apply Custom Attributes it across variety of vSphere Objects and for more details, please have a look at this post here. Once enabled for either a VM or an ESXi host, you will be able to assign an object-specific metadata "value" to these objects. An example would be a Custom Attribute called "Application Owner" and for VM1 I have a value of "Duncan Epping" and for VM2 I have a value of "Alan Renouf".
vSphere Tags also provides a metadata capability, but it goes beyond just VMs and ESXi host. vSphere Tags can be applied to all objects within the vSphere Inventory. A major distinction between Custom Attributes and vSphere Tags which will help answer our initial question is that vSphere Tags can not be used to store object-specific metadata, it is used for categorizing or logically organizing various objects together. An example would be a Tag called "Production" which can then be assigned to VM1 and VM2 for organizational purposes but you would not be able to assign a specific value for each of the VMs.
This distinction of not being able to assign object-specific metadata is the key difference between vSphere Tags and Custom Attributes. If you currently rely on this capability of Custom Attributes, you will not be able to completely migrate over to using vSphere Tags. A good way to think about vSphere Tags today is that they are similar to vSphere Folders but much more dynamic and search across all vSphere Objects. The lack of object-specific metadata for vSphere Tags is something that VMware Engineering is aware of today and hopefully they will be able to enhance in the future to support the Custom Attributes use case, so that vSphere Tags can be used exclusively.
In fact, I also hope to see vSphere Tags get enhanced so that permissions can also be applied onto Tags which would then propagate to the underlying associated vSphere Objects. I know this is another common request from customers that have looked at using vSphere Tags. I would like to also see a proper API exposed for Tags so that they can be managed and accessed programmatically, which can be quite handy for CMDB or provisioning systems. Today, there are no vSphere APIs for Tags, but you can manage them using PowerCLI Tagging cmdlet. Searchability is also another area that vSphere Tags can get further enhancements on. Today you can only search on objects by Tag name, but in the future I hope to see support for more complex queries which include searching through the values of the Tags assigned.
In summary, Custom Attributes are not going away anytime soon, at least until their capabilities are on-par with vSphere Tags. You will be able to continue accessing Custom Attributes which is available today in the vSphere C# Client or using the vSphere API. Custom Attributes are currently not visible in the vSphere Web Client, but you can use this custom vSphere Web Client plugin which makes the Custom Attributes available in the vSphere Web Client. Going forward, the future will be vSphere Tags, but in the mean time you may want to use both sets of metadata capabilities depending on your use case.
Does PowerCLI not expose creation and management of custom attributes?
Correct, today it only allows you to query for the information but not actually perform create/delete tags.
Many thanks for this, it completely clarifies the distinction and capability for these similar managed object types... Agreed that the ubiquitous tags should be extended so that they allow value(s)* to to be stored against managed objects - that would provide some serious power for us automators out there!
* Note that being able to store many values for an object/tag combination could also be useful.
Thanks much for the explanation. Very helpful!!
≈
my apologies for the "≈" typo...I have some questions on another mechanism for associating custom attributes with a VM--using the VM config advanced option (extra config) where [key, value] pairs can be added (VM needs to be powered off if entered via vSphere Web Client). My questions are 1) how does this mechanism compare to the two discussed in this article? 2) does vSphere 6.0 continue to provide API support for user to define these extra config as VM an advanced config option? Thanks!
Looking at the VS6 administration guide, the permissions hierarchy shows "tag category" and "tags" as descendant of the global root. That is like someone likes your suggestion of assigning permissions to tags!
Hi William. Thanks for the excellent and informative article.
I've been reading through the vSphere API documentation for vSphere 5.5, and I haven't actually found a way to interact with attributes via the API. Is this something that's limited to vSphere 6.0? Am I just missing something? I'd appreciate any guidance you could offer.
Custom Attributes are available within the Custom Fields Manager - http://pubs.vmware.com/vsphere-60/index.jsp?topic=%2Fcom.vmware.wssdk.apiref.doc%2Fvim.CustomFieldsManager.html
Here's a sample that exercises that API using the vSphere SDK for Perl https://github.com/lamw/vghetto-scripts/blob/master/perl/addVMCustomField.pl
Thanks William! That's the vSphere 6.0 API documentation, though. I haven't been able to find it anywhere in the 5.5 documentation. Any ideas?
The API has existed since 3.x, I only used the vSphere 6.0 doc as a reference. If you browse the 4.x/5.x version of the documentation, you'll find the exact same API 🙂
Doh! Thanks for the spoon-feeding. Hah.
Is this correct? I was able to add custom attribute to a datastore through both mob and vim api.
"Custom Attributes allows you to specify custom "keys" associated with either a Virtual Machine or an ESXi host object, which are the only supported objects"
Interesting, I just took a look and it looks like the API does in fact accept any Managed Object and just tested this myself on Datastore object and it does seem to work. Historically this feature had only supported VM/Host (https://pubs.vmware.com/vsphere-60/index.jsp?topic=%2Fcom.vmware.vsphere.hostclient.doc%2FGUID-0E69C0F6-9EDD-47E8-8F1D-200B394F54C1.html) which is what the UI limits but perhaps that was merely a UI limitation. I guess you could use Custom Attributes like Tags on the various Managed Objects. Nice find
Ziad,
I've updated the article to reflect this new info and I've also just published a new article on this topic here http://www.virtuallyghetto.com/2016/03/applying-custom-attributes-beyond-just-host-virtual-machine-objects.html Thanks for sharing this info!
Hi William,
Would you if there is a way to move from "Annotations" to "Tags"?
Thanks,
Michael
I have vSphere Client 6.5. I need to add some Tags and Categories. I don't see the New Category button. How do I get that to appear?
Never mind. 🙂 I was using the HTML5 version. I found it with the Flash Version.
Is there a way that customer attribute and tags both can be worked together if yes then how can they achive this ?
Apologies for the typo ... can we use custom attributes and tags together ?
Hi! your blog is amazing!
Did you know if its possible to use Rest Api to manage or retrieve the custom attributes?
if not, did you know if is on the current roadmap?
Thank you!