Instantly share code, notes, and snippets.

Embed
What would you like to do?
Managing SailPoint IdentityNow Sources via API using PowerShell. Associated Blog Post can be found here https://blog.darrenjrobinson.com/managing-sailpoint-identitynow-sources-via-the-api-with-powershell/
# Remove Content-Type otherwise repsonse from IDN Sources API complains about missing ID or Name in request. Go figure.
$Global:IDN.Headers.Remove("Content-Type")
# Get IdentityNow Sources
$IDNSources = Invoke-RestMethod -Method Get -Uri "https://$($orgName).api.identitynow.com/cc/api/source/list" -WebSession $IDN
write-host -ForegroundColor Green "$($IDNSources.Count) Sources found"
# Get Source Details
$sourceDetailsURI = "https://$($orgName).api.identitynow.com/cc/api/source/get"
foreach ($idnSource in $IDNSources) {
$sourceInfo = Invoke-RestMethod -Method Get -uri "$($sourceDetailsURI)/$($idnSource.id)" -WebSession $IDN
$sourceInfo
}
# Get Source Schema
$sourceSchemaURI = "https://$($orgName).api.identitynow.com/cc/api/source/getAccountSchema"
foreach ($idnSource in $IDNSources) {
$sourceSchema = Invoke-RestMethod -Uri "$($sourceSchemaURI)/$($source.id)" -WebSession $IDN
$sourceSchema
}
# Update Source
$sourceUpdateURI = "https://$($orgName).api.identitynow.com/cc/api/source/update"
# Change Headers
$Global:IDN.Headers.Add('Content-Type', "application/x-www-form-urlencoded; charset=UTF-8")
# Source Attrs to change
$sourceID = "36666"
$sourceDesscription = "CyberArk"
$sourceOwnerID = "1089123"
$sourceDetailsBody = "description=$($sourceDesscription)&ownerId=$($sourceOwnerID)"
$updateSource = Invoke-RestMethod -Method Post -Uri "$($sourceUpdateURI)/$($sourceID)" -Body $sourceDetailsBody -WebSession $IDN
$updateSource
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment