VMware vRA 8.3 and Multi Value Picker
I had a customer, asking me how to get the multi Value Picker working i vRA, I am using a new feature in version 8.3, so this will not work in earlier versions.
The use case for this was to add multiple uses to at AD Domain Group, and filter the uses, so i only shows the uses in the group, and that are not already a member of the group. They did not like the look of the datagrid, and wanted to use the Multi Value Picker instead.
First thing we need is a action in vRealize Orchestrator, that can return the the users for the OU that is not in the group.
Script:
// Returns AD:User object for a OU in AD // output: // - Array of AD:User // input: // - baseDN : string // - groupName: string var adUsers = new Array; const adHost = Server.findAllForType('AD:AdHost'); const ldapClient = adHost[0].getLdapClient(); // ActiveDirectory:AdHost searchResult = ldapClient.search( baseDn, LdapSearchScope.ONE, LdapDereferencePolicy.NEVER, 500, // limit 0, // timeout "(&(objectCategory=User)(objectClass=User))", null // attributes ); const ldapUsers = searchResult.getSearchEntries(); for each (ldapUser in ldapUsers) { var memberOf = ldapUser.getAttributeValue("memberOf"); if (memberOf){ if (memberOf.indexOf(groupName) == -1) { adUsers.push(ActiveDirectory.searchExactMatch("User",ldapUser.getAttributeValue("sAMAccountName"),1)[0]) } } else { adUsers.push(ActiveDirectory.searchExactMatch("User",ldapUser.getAttributeValue("sAMAccountName"),1)[0]) } } return adUsers;
in Cloud Assembly I have created a Custom Resource named “UserGroupAD”, looks like this.
And it has som “Additional actions” that looks this.
The one we are we want to modify the form on it the bottom one. and the form is the icon at the arrow.
In the form, we have to choose the “Users to add” field.
And then change the “dispaly type” to “Multi Value Picker”, the “Data Type” to “Reference” and the “Referemce type” is set to the vRO Object type “AD:User”.
i the “Value” fan we select “External source” and the vRO action.
for input, I have set an constant for the OU, as this is just a demo.
the field name is found here:
Al of this is only created for demo usage, and need på hardend before it can be used in produciotn, so use it at your onw risk.