Programmatically Adding Users and Groups to an API App Integration

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Programmatically Adding Users and Groups to an API App Integration

L0 Member
We would like to share a mechanism we developed for programmatically granting OAuth rights to groups and users. This requirement is related to this post on the Ideas forum. This does solve that need.This solution does not change the scopes on an integration. However, it does allow for programmatic modification of the users and groups that have access to an integration.Note that the API calls below must be performed by an identity in the authentication tree being modified.AssumptionsAn app integration exists with appropriate scopes (TargetApp) An administrative app exists for routine API work (AdminApp) No local users or groups currently exist for this requirement A csv file with the field ADObjects contains the listing of users/groups to add You have RSAT installedManual Set UpVia the UI, create a local group (TargetAppLocalGroup) Via the UI, create a local user (LocalApiUser) with Master Admin rights In Aperture,add TargetAppLocalGrouptoTargetApp In Aperture, add LocalApiUser to AdminAppAPI Calls UsedAuthorize/Integrated (or equivalent) asLocalApiUser to client_idAdminApp Identity/Browse to retrieveTargetAppLocalGroup Get-ADUSerfor new member user GUID Get-ADGroup for new member group GUID Identity/Validate to verify Venafi can find new member user or group Identity/AddGroupMembers to add user or groupCode Sample$AppIntg = "TargetAppLocalGroup"$BrowseResponse = Identity/Browse -Filter $AppIntg -Limit 1 -IdentityType 2$TargetGroup = @{PrefixedUniversal="$($BrowseResponse.Identities[0].PrefixedUniversal)"}Import-Csv $InputdataFile |%{ $GetADResponse = Get-ADGroup $_.ADObjects # or Get-ADUser as appropriate) $Identity = ConvertTo-VFIdentity -ObjectGUID $GetADResponse.ObjectGUID.Guid -Domain "AD+Your Domain" $ID = @{PrefixedUniversal="$($Identity.Identity)"} $ValidateResponse = Identity/Validate -ID $ID $Member = @( @{PrefixedUniversal="$($ValidateResponse.ID.PrefixedUniversal)"} ) $AddMembersResponse = Identity/AddGroupMembers -Group $Group -Members $Member -ShowMembers $True}NotesError checking and Try/Catches omitted for clarity ConvertTo-VFIdentity is a utility we wrote that converts AD GUIDs to Venafi AD Identity strings.
2 REPLIES 2

L0 Member
Hi Ed, That is a very similar problem that we are trying to solve. Would you be able to share yourConvertTo-VFIdentity code here? Thanks Darren Davis

L0 Member
Thanks Edfora very detailed response. Venafi should give you a prize for cracking their obfuscation on this. Great work and much appreciated. Darren
  • 49 Views
  • 2 replies
  • 0 Likes
Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!

The LIVEcommunity thanks you for your participation!