I hit a problem recently where I wanted to selectively pick out REST hosts from vRealize Orchestrator, without having to rely on naming conventions (as I had in the past) to determine the type of infrastructure.
Global Tags allow us to tag objects in vRO – workflows, actions, plugin objects, configurations to group them together. This is simple through the UI, but setting/retrieving this programatically proved a little tricky to figure out.

To achieve this, I used something I have not used before in vRealize Orchestrator, something not very well documented, and as such I thought I would put a post together on how to query return a list of REST hosts based on tags.
Setting a Global Tag on a REST Host:
// tag the 'my_rest_host' RESTHost object with the global tag
// 'Rubrik' (note the colon before the tag value denotes global
// tags)
Server.tagGlobally(my_rest_host, ':Rubrik');
Retrieving REST Hosts with a specific global tag:
// get objects with global tag 'Rubrik'
var get_hosts = Server.queryByTags([{'tag':':Rubrik'}],'REST:RESTHost');
var out = [];
for(var rest_host_id in get_hosts){
var rest_host = get_hosts[rest_host_id];
out.push(rest_host.name);
}
// return an array of RESTHost objects
return out;