Last active
October 30, 2018 05:36
-
-
Save darrenjrobinson/b3d2108281fdbfe72a8cb8983e0a338d to your computer and use it in GitHub Desktop.
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/
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
# 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