VMware Cloud Community
Nick_Andreev
Expert
Expert

Determine Business Group VM belongs to

There are multiple entities in vRA data model that the business group (aka provisioning group) can be determined from, such as Owner, VirtualMachineTemplate, etc. But when I try to get a link to the Business Group I always get an empty array.

Can you see anything wrong with the code below?

var model = "ManagementModelEntities.svc";

var entitySetName = "VirtualMachines";

var virtualMachines = vCACEntityManager.readModelEntitiesByCustomFilter(vcacHost.id, model, entitySetName, null, null);

for each (var vm in virtualMachines) {

     var owner = vm.getLink(vcacHost, "Owner");

     var provisioningGroup = owner[0].getLink(vcacHost, "ProvisioningGroup");

     System.log(provisioningGroup);

}

---
If you found my answers helpful please consider marking them as helpful or correct.
VCIX-DCV, VCIX-NV, VCAP-CMA | vExpert '16, '17, '18
Blog: http://niktips.wordpress.com | Twitter: @nick_andreev_au
0 Kudos
2 Replies
Uridium454
Enthusiast
Enthusiast

Nick, I just posted a bit of code that may help in your below quest - Return all of the VMs owned by a particular business group

I will work through your code a bit later today, and see what I can come up with.

0 Kudos
parmarr
VMware Employee
VMware Employee

Please refer to https://communities.vmware.com/message/2490714#2490714

Sincerely, Rahul Parmar VMware Support Moderator
0 Kudos