Skip to content

Instantly share code, notes, and snippets.

@darrenjrobinson
Created September 8, 2018 23:58
Show Gist options
  • Save darrenjrobinson/48412081786894f62990620797b4fdfc to your computer and use it in GitHub Desktop.
Save darrenjrobinson/48412081786894f62990620797b4fdfc to your computer and use it in GitHub Desktop.
IdentityNow Search Users and Return Sources and Entitlements
# IdentityNow Search via API
# API Access Client ID
$clientID = 'yourClientID'
# API Access Client Secret
$clientSecret = 'yourClientSecret'
# Basic Auth
$Bytes = [System.Text.Encoding]::utf8.GetBytes("$($clientID):$($clientSecret)")
$encodedAuth =[Convert]::ToBase64String($Bytes)
# IdentityNow Organisation
$org = "yourOrgname"
# Search Limit. 1000 is the maximum
$searchLimit = '1000'
# Search Identities
$URI = "https://$($org).api.identitynow.com/v2/search/identities?"
# Query
$query = 'lastname EQ robinson'
# Search Accounts
$Accounts = Invoke-RestMethod -Method Get -Uri "$($URI)limit=$($searchLimit)&query=$($query)" -Headers @{Authorization = "Basic $($encodedAuth)" }
write-host "Search returned $($accounts.Count) account(s)"
foreach ($identity in $Accounts){
write-host ""
Write-host "Details for $($identity.name)"
write-host " $($identity.source.name) : $($identity.displayName)"
foreach($source in $identity.access){
write-host " Source: $($source.displayName) Access Type: $($source.type)"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment