VMware Cloud Community
jselleck
Contributor
Contributor
Jump to solution

Get VM owner r on behalf of owner from vcac for requested VM (using vco).

I am trying to get the VM owner from vcac for pre-provisioning purposes.  I cannot find it in properties of the VM. 

Can someone point me in the right direction?

I'm passing the VCAC:Entity, VCAC:VirtualMachine, The VCAC VM Propertys as an array into my flow.  The owner is eluding me.

Thanks!

Tags (3)
1 Solution

Accepted Solutions
willonit
Hot Shot
Hot Shot
Jump to solution

There should be a property  __Legacy.Workflow.User and __Legacy.Workflow.ImpersonatingUser. You should find those keys if you loop through the VM Properties array.

View solution in original post

0 Kudos
6 Replies
willonit
Hot Shot
Hot Shot
Jump to solution

There should be a property  __Legacy.Workflow.User and __Legacy.Workflow.ImpersonatingUser. You should find those keys if you loop through the VM Properties array.

0 Kudos
jselleck
Contributor
Contributor
Jump to solution

Thanks!  I wasn't sure if I should use those since they say __Legacy.   Legacy makes you think they replaced it with a better way.

-Justin

0 Kudos
willonit
Hot Shot
Hot Shot
Jump to solution

I want to follow up on some of my recent findings on this topic and the "__Legacy" thing may have something to do with it. I can not get the impersonating user field to be filled and the user field is always filled with the user that makes the request even if you request on behalf of a different user. However, the user specified in the owner field when making a request will be added as a custom field to the annotations section of the VM in vCenter. There is an action called getCustomField that you can use to retrieve that property and therefore get the user. I would rather have it in the properties array but this will do. Hope this is helpful.

willonit
Hot Shot
Hot Shot
Jump to solution

The owner is contained in the vCACEntity but it is not obvious at all. See my post on obtaining the owner from the entity. This can be used in an action or a scripting object.

atfrys
Hot Shot
Hot Shot
Jump to solution

How can I update that property?

Thank you

0 Kudos
deltadental
Contributor
Contributor
Jump to solution

Anyone know how to change the __Legacy.Workflow.User property?

setting either or both __Legacy.Workflow.User __Legacy.Workflow.ImpersonatingUser has no effect

Using vCO SDK to request catalog item.

                string attributes;

                attributes = "TotalStorageSize,string," + storage;

                attributes += ",DNSServer,string," + domainController;

                attributes += ",DNSZone,string," + domain;

                attributes += ",ServerDomain,string," + domainPrefix;

                attributes += ",ServerHostName,string," + hostName;

                attributes += ",ServerType,string," + serverType;

                attributes += ",isDMZ,string," + isDMZ;

                attributes += ",AdMachineCleanupDomain,string," + domainController;

                attributes += ",VirtualMachineCPUCount,string," + cpuCount;

                attributes += ",disks,string," + disks;

                attributes += ",VirtualMachineMemorySize,string," + memory;

                attributes += ",VirtualMachineNetwork0ProfileName,string," + vlan;

                attributes += ",__request_reason,string," + __request_reason;

                attributes += ",provisioningGroupId,string," + PRE_provisioningGroupId;

                attributes += ",item,vCACCAFE:CatalogItem," + dunes_blueprintURI;

                attributes += ",requestor,string," + requestor;

                WorkflowToken wfToken = new WorkflowToken();

                wfToken = vCO.ExecuteWorkflow("33295b30-24e5-4938-be99-7168ac0ca05c", vCACAdminUser, vCACAdminPW, attributes);

In the workflow I am setting

var jsRequestor = { name: "provider-__Legacy.Workflow.ImpersonatingUser", value: requestor};

param.push(jsRequestor);

var jsRequestor2 = { name: "provider-__Legacy.Workflow.User", value: requestor};

param.push(jsRequestor2);

0 Kudos