Instantly share code, notes, and snippets.

Embed
What would you like to do?
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