Using vSphere Tags via vCO

As vSphere 5.5 currently stands, the only way to interact with vSphere tags is via PowerCLI.   This leaves vCO out of the party without some effort to build it manually.   I am working on a solution where I wanted to include tags in some automation to enable some awesomeness so I explored if it was possible to expose to this vCO without huge effort.  Success!


It wasn’t too difficult to build this.  The two most difficult parts were setting up the PowerShell host for vCO (google it… it’s difficult.. at least it was for me the first time around), and parsing of the XML returned from PowerShell to vCO to get the data I wanted.   These workflows are a bit rough but they work as a first draft.   For anything production caliber you’ll want to evaluate the performance impact of hitting the powershell host as often, and definitely change the password field from string (proof of concepts!).

What I have built so far is a workflow “JaaS Tags- Add Tag” that accepts strings for the name of the tag, and virtual machine name.  This fires off powershell commands in a vCO action:


To show how it works running manually in the vCO client:



And to show that the tag is actually applied, you can find it in the Web Client:


Now, I also have a workflow to find VMs from the tag that is supplied.  I needed flexibility out of these in the solution that i’m working on so the output from this one is two arrays – one of the name in a string, and one of VC:VirtualMachine type.




Running this guy manually, just supply the tag name:


And to show the output parameters, you can see that in the vCO client:


Yay Tags!   Now you can include these workflows in other solutions to utilize tags in ways they weren’t intended.  Stay tuned for the solution I built this for.

I’ve posted an export of this package to FlowGrab, check it out here:




Tagged , , , , ,

3 thoughts on “Using vSphere Tags via vCO

  1. […] functionality I also have it fire off a vCO workflow that calls PowerShell (talked about here) to add the vSphere tag.  Not elegant but it works.  This will be improved later.      So now […]

  2. Brian says:

    I could be wrong, but I thought that the entire VSphere API was accessible via VCO. Therefore you should be able to use the API explorer to find any methods for interacting with tags through that.

    However – if that doesn’t work, then you could use double cloud’s code generator to monitor your connection to Vcenter and catch the API calls from there.

    I’ll be digging into this soon as I want to use tags to hold attributes such as DR tier and owner for cloud provisioned VMs, and I hope to use VCO to drive the placement. I’ll let you know what I find.

    • jasper9 says:

      Yup you would be right BUT the Tag functionality is in a private API that is unavailable today. PowerCLI is the only way. If you find a way to hack around it let me know!

Leave a Reply

Your email address will not be published. Required fields are marked *