I need some help with removing a large number of identities from SailPoint.
I have a list of more than 1,000 identities (without links) that need to be removed from the platform. I would like to know the fastest, safest, and recommended way to perform this operation in bulk instead of deleting the identities one by one.
Could someone explain in detail how I can accomplish this?
You can try running below Rule. The conditions assumed is you want to delete all identities which do not have any Link object. Try first to print identities which are selected and then try running tis code. Make note this code will delete identities.
Filter f = Filter.eq("workgroup", "false");
QueryOptions qo = new QueryOptions ();
qo.add(f);
Iterator itr = context.search(Identity.class, qo );
while(itr.hasNext())
{
Identity identity = itr.next();
List links = identity.getLinks();
if(links == null)
{
// this is what you are looking for
System.out.print("identity - " + identity.getName());
context.removeObject(identity);
context.commitTransaction();
}
}
context.decache();
Just to clarify, I want to remove the identities based on a list that I already have. The fact that they don’t have links is only additional information.
In other words, I already have the list of identity names/IDs, and I would like to know the best way to bulk delete those specific identities from SailPoint using that list.
As identities don’t have any application accounts, you can delete them by running Prune Identities task. This task removes all such identities which don’t have Link objects, but it skips deletion if Identity is a manager.
You can also delete Identities from IIQ console or stand alone rule.
IIQ command mentioned below can be used to delete Identity from IIQ console →
Thanks for the suggestion. Could you please explain how to use a standalone Rule for this use case? How do I create it, execute it, and pass my list of identities to the Rule?
you can place all the identity names (or IDs) in a CSV file and read them using a BeanShell script executed from the IIQ Console. For each identity, retrieve it using context.getObjectByName(), verify that it has no Link objects, and then delete it using context.removeObject(identity). This approach is efficient for bulk deletion of a predefined list.
import java.io.*;
import sailpoint.object.Identity;
BufferedReader br = new BufferedReader(
new FileReader("/tmp/deleteIdentities.csv")
);
String identityName;
while ((identityName = br.readLine()) != null) {
Identity identity = context.getObjectByName(Identity.class, identityName.trim());
if (identity == null) {
System.out.println(identityName + " not found.");
continue;
}
if (identity.getLinks() != null && !identity.getLinks().isEmpty()) {
System.out.println(identityName + " has links. Skipping.");
continue;
}
context.removeObject(identity);
context.commitTransaction();
System.out.println(identityName + " deleted.");
}
br.close();