Automate everything!

vRO Code - Finding vRA IaaS entities using OData query

odata logo As I’ve explained in an earlier blog the vRA API is split into two parts: CAFE and Iaas. This post is about the latter which still contains a lot of the vRA entities. When working with those entities you regularly need to find them first. One of the methods for finding vRA Iaas entities is using an odata query. The example I’ll be using is finding all reservations for a specific business group. First thing you’ll need is a script object or action with these inputs:

  • iaasHost (type: vCAC:vCACHost)
  • businessGroup (type: vCACCAFE:BusinessGroup)

The code below will find all reservations for the given Business Group``` var hostid =; var modelName = “ManagementModelEntities.svc”;

reservations = vCACEntityManager.readModelEntitiesBySystemQuery(hostid, modelName, “HostReservations”, “ProvisioningGroup/GroupID eq guid’"+ + “’”);