-
-
Save darrenjrobinson/2bb57df933acb8e8e6b898039cd67539 to your computer and use it in GitHub Desktop.
Create IdentityNow Account via API and PowerShell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Your API Client ID | |
$clientID = 'yourClientID' | |
# Your API Client Secret | |
$clientSecret = 'yourClientSecret' | |
$Bytes = [System.Text.Encoding]::utf8.GetBytes("$($clientID):$($clientSecret)") | |
$encodedAuth = [Convert]::ToBase64String($Bytes) | |
# Your IdentityNow Tenant Name | |
$orgName = 'yourTenantOrgName' | |
# SourceID of the Flat File Source to create the new account against. | |
# Navigate to the Source in the IdentityNow Portal and get the SourceID from the URL | |
# https://<orgName>.identitynow.com/ui/admin#admin:connections:sources | |
$sourceID = 'yourIdentityNowSourceID' | |
$baseURI = "https://$($orgName).api.identitynow.com" | |
# Create User Details | |
$body = @{"id" = 'rick.sanchez'; | |
"name" = 'rick.sanchez'; | |
"givenName" = 'Rick'; | |
"familyName" = 'Sanchez'; | |
"displayName" = 'Rick Sanchez'; | |
"e-mail" = 'rick@councilofricks.com' | |
} | |
$body = $body | Convertto-json | |
$headers = @{'Content-Type' = 'application/json'; | |
Authorization = "Basic $($encodedAuth)"; | |
} | |
try { | |
Invoke-RestMethod -Method POST -Uri "$($baseURI)/v2/accounts?sourceId=$($sourceID)&org=$($orgName)" -Headers $headers -Body $body | |
} | |
catch { | |
write-host -ForegroundColor yellow "Well, that didn't work. Check your script" | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment