VMware Cloud Community
getvrohelp
Enthusiast
Enthusiast
Jump to solution

Best way to add requester to power user group vcenter machine

Hi everyone. Hoping to get some assistance here. I have looked through the library and I am just not sure how to go about adding the requester as a power user in vcenter to the machine. I simply need to add them to the power users group on the vm itself. Any help would be greatly appreciated. I'm using vra / vro 8.2. 

Reply
0 Kudos
1 Solution

Accepted Solutions
getvrohelp
Enthusiast
Enthusiast
Jump to solution

Figured it out. This is what it took

Input:

vc:virtualmachine

variables:

vimHost - vc:sdkconnection

vcAuth - vc:authorizationManager

owner - input property of requester

---- code ---

var authMgr = vcVm.vimHost.authorizationManager;

System.log("authMgr is: " + authMgr);
System.log("authMgr.id is: " + authMgr.id);
System.log("vcVM is:" + vcVm);
System.log("owner is" + owner);

var permission = new Array();
permission[0] = new VcPermission();
permission[0].principal = '%domain%\\' + owner; // %domain% is the FQDN
permission[0].roleId = 4;
permission[0].propagate = false;
permission[0].group = false;
authMgr.setEntityPermissions(vcVm, permission);

View solution in original post

1 Reply
getvrohelp
Enthusiast
Enthusiast
Jump to solution

Figured it out. This is what it took

Input:

vc:virtualmachine

variables:

vimHost - vc:sdkconnection

vcAuth - vc:authorizationManager

owner - input property of requester

---- code ---

var authMgr = vcVm.vimHost.authorizationManager;

System.log("authMgr is: " + authMgr);
System.log("authMgr.id is: " + authMgr.id);
System.log("vcVM is:" + vcVm);
System.log("owner is" + owner);

var permission = new Array();
permission[0] = new VcPermission();
permission[0].principal = '%domain%\\' + owner; // %domain% is the FQDN
permission[0].roleId = 4;
permission[0].propagate = false;
permission[0].group = false;
authMgr.setEntityPermissions(vcVm, permission);