Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darrenjrobinson/261bc6240475e54502fa3865ac049558 to your computer and use it in GitHub Desktop.
Save darrenjrobinson/261bc6240475e54502fa3865ac049558 to your computer and use it in GitHub Desktop.
Update SailPoint IdentityNow Identity Cube Attribute to be Searchable and available for Correlation. Associated post https://blog.darrenjrobinson.com/indexing-a-sailpoint-identitynow-attribute-in-an-identity-cube-for-use-in-correlation-rules/
$orgName = "yourOrgname"
# Get Identity Attr
$getIdentityAttributesBaseURI = "https://$($orgName).api.identitynow.com/cc/api/identityAttribute/list"
# Get Attr Only
$getIdentityAttrBaseURI = "https://$($orgName).api.identitynow.com/cc/api/identityAttribute/get?name="
# Update URI
$attributeUpdateBaseURI = "https://$($orgName).api.identitynow.com/api/identityAttribute/update?"
$identityAttrs = Invoke-RestMethod -Method Get -Uri $getIdentityAttributesBaseURI -Headers @{Authorization = "$($v3Token.token_type) $($v3Token.access_token)"; "content-type" = "application/json"}
$attributeName = "yourAttributeName"
$attrToIndex = $identityAttrs | select-object | where-object {$_.name -eq $attributeName}
$identityAttr = Invoke-RestMethod -Method Get -Uri "$($getIdentityAttrBaseURI)$($attrToIndex.name)" -Headers @{Authorization = "$($v3Token.token_type) $($v3Token.access_token)"}
# Update an Attribute to be searchable
$identityAttr.searchable = $true
$identityAttrSources = $identityAttr.sources | convertto-json
$identityAttr.sources = $null
$identityAttr.targets = $null
$identityAttrUpdate = $identityAttr | convertTo-json
$identityAttrSources = '"sources": [' +$identityAttrSources + ']'
$identityAttrBody = $identityAttrUpdate.Replace("`"sources`": null", $identityAttrSources)
$identityAttrBody = $identityAttrBody.Replace("`"extendedNumber`": null,", "" )
$identityAttrBody = $identityAttrBody.Replace("`"targets`": null,", "" )
$identityAttrBody
$updateAttribute = Invoke-RestMethod -Method Post -Uri "https://$($orgName).api.identitynow.com/cc/api/identityAttribute/update?name=$($attrToIndex.name)" -Headers @{Authorization = "$($v3Token.token_type) $($v3Token.access_token)"; "content-type" = "application/json"} -Body $identityAttrBody
$updateAttribute
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment