Rediger

How to delete and restore agent identity objects

Microsoft Graph documents soft deletion and recovery for application and agent identity objects. Its public delete API references don't specify whether deleting a blueprint or blueprint principal also deletes child agent identities or associated agent user accounts. Don't rely on a cascade unless Microsoft confirms the behavior for your scenario.

For details on documented behavior and unresolved related-object behavior, see Agent identity deletion.

Prerequisites

To delete and restore agent identity objects, you need:

  • Agent ID Administrator to view and manage agent identity objects.
  • Cloud Application Administrator to delete the blueprint application and its service principal.
  • The Application.ReadWrite.All permission for Microsoft Graph operations on blueprint applications and service principals.
  • The AgentIdentity.DeleteRestore.All permission for Microsoft Graph delete and restore operations on agent identities.
  • The AgentIdentity.ReadWrite.All permission for permanent deletion of soft-deleted agent identities, or AgentIdentityBlueprintPrincipal.ReadWrite.All to permanently delete a soft-deleted blueprint principal.
  • The AgentIdentityBlueprintPrincipal.DeleteRestore.All permission to restore a soft-deleted blueprint principal.
  • The AgentIdUser.ReadWrite.IdentityParentedBy permission to delete or restore an associated agent user.

Delete a blueprint

Deleting agent identity objects isn't supported in the Microsoft Entra admin center. Use Microsoft Graph API or Microsoft Entra PowerShell to delete blueprints and agent identities.

The blueprint application and blueprint principal are separate directory objects with separate delete endpoints. Use the endpoint for the object you intend to delete, then check the other object and related agent identities independently.

Note

Deleting an application moves it to the deleted items container, where it can be restored within 30 days. The agentIdentity delete API documents the same recovery period for an agent identity. The Graph delete API references don't specify whether deleting a blueprint application or principal also deletes child agent identities or associated agent user accounts.

To delete the blueprint application:

DELETE https://graph.microsoft.com/v1.0/applications/{blueprint-app-object-id}

To delete the blueprint principal:

DELETE https://graph.microsoft.com/v1.0/servicePrincipals/{blueprint-principal-object-id}

Note

For permissions and current behavior, see the Microsoft Graph delete application and delete servicePrincipal references.

The public Graph API references describe deletion of the addressed object, but don't specify cascade behavior for child agent identities or associated agent user accounts. Record their object IDs before deletion and check their states independently afterward. For more information, see Agent identity deletion.

Important

Don't assume that restoring a blueprint application or principal restores related objects. If a child agent identity or associated user account was soft deleted, restore or manage that object separately.

Delete an agent identity

Use the agentIdentity-specific Graph operation to delete one agent identity. The API moves the object to a temporary container, where it can be restored within 30 days.

DELETE https://graph.microsoft.com/beta/servicePrincipals/{agent-identity-object-id}/microsoft.graph.agentIdentity

For the API's permissions and current behavior, see Delete agentIdentity.

Restore a blueprint principal

You can restore a soft-deleted blueprint principal within 30 days. Restoring an application doesn't automatically restore its associated service principal, so restore the blueprint principal separately. Restoring agent identity objects isn't supported in the Microsoft Entra admin center. Use Microsoft Graph API or Microsoft Entra PowerShell. For details, see Restore deleted items.

POST https://graph.microsoft.com/v1.0/directory/deletedItems/{blueprint-principal-object-id}/restore

Restore child agent identities

If an agent identity is soft deleted, restore it by its own object ID.

Note

The Microsoft Graph /directory/deletedItems endpoint doesn't support filtering by agent identity type. Query for deleted service principals and filter results on the client side using known object IDs, app IDs, or display names to identify the correct agent identities.

  1. List soft-deleted service principals to find affected agent identities:

    GET https://graph.microsoft.com/v1.0/directory/deletedItems/microsoft.graph.servicePrincipal
    
  2. Filter the results on the client side to identify agent identities linked to your blueprint, then restore each one:

    POST https://graph.microsoft.com/v1.0/directory/deletedItems/{agent-identity-object-id}/restore
    

Permanently delete agent identity objects

The Graph API references don't specify an agent identity-specific quota or when quota becomes available after deletion. Check current Microsoft Entra service limits before capacity planning.

Caution

Permanently deleted objects can't be restored. Only permanently delete objects when you're certain they're no longer needed.

Permanently delete a soft-deleted agent identity:

DELETE https://graph.microsoft.com/v1.0/directory/deletedItems/{agent-identity-object-id}

Permanently delete a soft-deleted blueprint principal:

DELETE https://graph.microsoft.com/v1.0/directory/deletedItems/{blueprint-principal-object-id}

Permanently delete a soft-deleted blueprint application:

DELETE https://graph.microsoft.com/v1.0/directory/deletedItems/{blueprint-app-object-id}

Agents' user accounts

The agentIdentity delete API doesn't specify what happens to an associated agent user's account. Check the user object independently. If you confirm that the account is no longer needed, delete it separately:

DELETE https://graph.microsoft.com/beta/users/microsoft.graph.agentUser/{agent-user-object-id}

For the API's permissions and current behavior, see Delete agentUser.