Bulk Removal of Identities

Which IIQ version are you inquiring about?

8.3

Hello everyone,

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?

Thank you!

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();

Thank you for your response.

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.

Then you can use iterate over the list you have and use below APIs:

context.removeObject(identity);
context.commitTransaction();
context.decache();

@Nureen_Govan If these identities doesn’t have any links, you can run Prune Identities task to take care of identity deletion.

In case you want to do it via code, please do it via IIQ Console. That is the recommended way to do delete it.

Don’t do context. decache(), it’ll decache identity and other IIQ objects available in the context and results in Lazily initialization exception.

Could you please explain how to perform this bulk identity deletion using the IIQ Console?

Hi @Nureen_Govan ,

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 →

> delete identity

Details are given here → Commonly Used Commands - SailPoint IdentityIQ

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?

Sample code →

//Assuming users is a list identity id (String)

for(String id : users) {

Identity identity = context.getObjectById(id);

if(identity != null) {

Terminator terminator = new Terminator(context);
terminator.deleteObject(identity);
context.commitTransaction();

}

}

Hi @Nureen_Govan

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();

@Nureen_Govan Please follow this article: Delete identities in Bulk - IdentityIQ (IIQ) / IIQ Discussion and Questions - SailPoint Developer Community