Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.