Join our Newsletter — 33% off our NHI Course
Home› Guides› How to restore deleted users, groups, apps and…
Guide Resilience & Recovery

How to restore deleted users, groups, apps and service principals in AD and Entra ID: Recycle Bin, authoritative restore and soft delete

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 28 November 2026 16 min read
On this page

A deleted user, group or service principal can stop a payroll run, lock out an administrator or break every integration that depended on it, and the time you have to put it back is fixed by settings you chose months earlier. This guide is the object-level runbook: how to bring back individual users, groups, organisational units, app registrations and service principals in on-premises Active Directory and in Microsoft Entra ID, whether the deletion was a mistake, a bad script or a deliberate act. It covers the AD Recycle Bin, authoritative restore with ntdsutil when the Recycle Bin was off, the Entra soft-delete window, hybrid objects that Entra Connect will delete again, and what to check before you call the restore done. It is written for directory administrators and incident responders. Forest-wide recovery and choosing a recovery path are covered in the Identity Recovery Guide, and backup design in Active Directory Backup Strategy; this page does not repeat them.

Key takeaways

  • The AD Recycle Bin only helps with deletions made after it was enabled. It is off by default and enabling it is irreversible, so turn it on now rather than during an incident.
  • Without the Recycle Bin, group membership is the hard part. An authoritative restore brings the account back, but you still have to replay the back-links with the .ldf file ntdsutil generates.
  • Entra ID keeps only some object types for 30 days. Users, Microsoft 365 groups, cloud security groups, app registrations, service principals, administrative units, Conditional Access policies and named locations can be restored; everything else must be re-created.
  • Restoring an app registration does not restore its service principal. Restore the application first, then the service principal through Microsoft Graph, then test sign-in.
  • Synced objects are restored at the source. For users and groups synced by Entra Connect, fix the on-premises object or the sync scope; restoring only in Entra ID may be undone by the next sync cycle.

Decide where the object lives before you restore it

The first question is not "how do I restore" but "which directory is the source of authority for this object". A cloud restore of a synced user can be reversed by Entra Connect, and an on-premises restore of a cloud-only group does nothing. Work from this table.

What was deletedSource of authorityRestore methodWindow
AD user, group, computer or OU, Recycle Bin enabledActive DirectoryADAC Deleted Objects container, or Get-ADObject -IncludeDeletedObjects piped to Restore-ADObjectThe deleted object lifetime (msDS-DeletedObjectLifetime)
AD object, Recycle Bin not enabledActive DirectoryAuthoritative restore with ntdsutil from a system state backup or a latent global catalog, then replay group linksThe tombstone lifetime (tombstoneLifetime) and the age of your backup
Synced user or group (Entra Connect)Active DirectoryRestore in AD, or correct the sync filter, then let sync rematch the soft-deleted Entra object30 days for the Entra object to be rematched
Cloud-only user, Microsoft 365 group or cloud security groupEntra IDDeleted users or Deleted groups page, or Microsoft Graph restore30 days
App registrationEntra IDApp registrations, Deleted applications tab, or Graph30 days
Service principal or administrative unitEntra IDMicrosoft Graph deletedItems restore only30 days
Conditional Access policy or named locationEntra IDConditional Access, Deleted policies or Deleted named locations30 days
Any other Entra object typeEntra IDNone: hard deleted, re-create from your configuration exportNone

If the deletion was malicious, treat it as part of an incident: confirm the deleting account is contained before you restore anything, because a restored object can be deleted again in seconds. Deleting accounts to block access is catalogued as ATT&CK T1531 Account Access Removal; see MITRE ATT&CK T1531 Account Access Removal.

Active Directory: restore with the Recycle Bin

Microsoft documents that the Recycle Bin requires a forest and domain functional level of Windows Server 2008 R2 or higher and membership of Domain Admins to enable. Once on, all link-valued and non-link-valued attributes of a deleted object are preserved, so a restored user regains its group memberships within and across domains. It is not enabled by default, it cannot be disabled once enabled, and it only restores objects deleted after it was switched on.

  1. Confirm it is on and read the lifetimes. Check the forest optional features, then read msDS-DeletedObjectLifetime and tombstoneLifetime on CN=Directory Service,CN=Windows NT,CN=Services in the configuration partition. Do not assume defaults; the values set how long you have.
  2. Find the object. In Active Directory Administrative Center (dsac.exe) open the domain's Deleted Objects container, or query with Get-ADObject and the -IncludeDeletedObjects switch, filtering on sAMAccountName, msDS-lastKnownRDN, lastKnownParent or whenChanged. Deleted objects carry isDeleted; objects that have passed the deleted object lifetime carry isRecycled and can no longer be restored this way.
  3. Restore parents first. If an OU was deleted with its children, restore the OU before its contents, otherwise children cannot return to their last known parent. Restore-ADObject uses lastKnownParent and msDS-lastKnownRDN unless you give -TargetPath and -NewName.
  4. Dry run, then restore. Run the pipeline with -WhatIf to see what it will touch, then pipe Get-ADObject results into Restore-ADObject. In ADAC use Restore, or Restore To for a different location.
  5. Use a writable DC. The cmdlet does not work against a read-only domain controller or an AD snapshot.

For a bulk deletion with a known time window, Microsoft's own example filters on whenChanged, isDeleted and not isRecycled, scoped to a lastKnownParent, which restores only what was removed in that window rather than the whole Deleted Objects container. If the domain naming or schema master roles are not where the enable step expects them, Microsoft suggests moving them to a root domain DC before enabling.

Active Directory: authoritative restore when the Recycle Bin was off

Without the Recycle Bin, deletion strips most attributes, including memberOf, and removes the object from each group's member attribute. Microsoft's procedure restores the object authoritatively and then restores group membership; each security principal must exist before its memberships can be replayed. Plan for an outage of the recovery DC and for user passwords reverting to the backup.

  1. Look for a latent global catalog. A GC in the user's domain that has not yet replicated the deletion is the best source. Stop its inbound replication immediately with repadmin /options <dc> +DISABLE_INBOUND_REPL. If none exists, use the most recent system state backup of a GC in that domain.
  2. Boot into Directory Services Restore Mode. You need the DSRM password; if it is unknown, reset it online beforehand with ntdsutil "set dsrm password". Restore system state if you are working from backup.
  3. Mark only what you need as authoritative. Use ntdsutil "authoritative restore" "restore object <DN>" for individual objects. "restore subtree" on an OU rolls back every attribute of everything in it, including passwords, group membership and security descriptors changed since the backup, so use it only when most of the OU was deleted. Any deleted parent containers must also be restored authoritatively.
  4. Raise the version increment on a second attempt. If the same objects were restored and marked authoritative before, Microsoft says the version must be raised above the default of 100000 (verinc) or the objects will not replicate out.
  5. Keep the generated files. ntdsutil writes ar_<timestamp>_objects.txt and ar_<timestamp>_links_usn.loc.ldf. The .ldf restores group memberships in the user's home domain; import it with ldifde -i -f after the restore has replicated. A GC source produces one file per domain in the forest.
  6. Replicate out, then re-enable inbound. Restart normally, push the restored objects with repadmin /syncall, import the .ldf, then remove the DISABLE_INBOUND_REPL option.
  7. Fix what the GC does not track. Domain local group memberships in other domains are not held by a global catalog, so add those back manually or restore them separately.

When there is no usable backup, deleted objects can be reanimated from the Deleted Objects container while the tombstone exists, using the Return Deleted Objects LDAP control. Microsoft notes that a tombstone keeps only a few attributes, such as SID, ObjectGUID, lastKnownParent and sAMAccountName, so a reanimated account has its original SID but needs its password, profile and every group membership set again. Treat it as a last resort and record it as a rebuild, not a restore.

Entra ID: restore from soft delete

Microsoft's recovery guidance lists the soft-deletable types and what comes back. Users keep their object ID, group memberships, roles, licences and application assignments; Microsoft 365 groups and cloud security groups keep their memberships and application assignments; app registrations, service principals, administrative units, Conditional Access policies and named locations keep all properties. After 30 days soft-deleted objects are hard deleted, and Microsoft states that neither administrators nor Microsoft can restore hard-deleted items.

ObjectWhere to restoreLeast privileged role (delegated)Graph permission
UserEntra ID, Users, Deleted users, Restore userUser Administrator (higher role for users holding privileged roles)User.DeleteRestore.All
GroupEntra ID, Groups, Deleted groupsGroups Administrator; Privileged Role Administrator for role-assignable groupsGroup.ReadWrite.All
App registrationApp registrations, Deleted applications, Restore app registrationApplication Administrator, Cloud Application Administrator or the application ownerApplication.ReadWrite.All
Service principalGraph only: POST /directory/deletedItems/{id}/restoreApplication Administrator or Cloud Application AdministratorApplication.ReadWrite.All
Administrative unitGraph onlyPrivileged Role AdministratorAdministrativeUnit.ReadWrite.All
Conditional Access policyConditional Access, Deleted policiesConditional Access AdministratorNot used in the portal path
  1. List what is in the bin. Graph requires a type cast: GET /directory/deletedItems/microsoft.graph.user (or .group, .application, .servicePrincipal, .administrativeUnit). Ordering by deletedDateTime needs the ConsistencyLevel: eventual header and $count=true, which is the quickest way to see a mass deletion in order.
  2. Check the group type. For soft-deleted security groups, Graph returns securityEnabled as false; use groupTypes instead (["Unified"] is a Microsoft 365 group, an empty list is a security group). Microsoft also lists tenants where security group soft delete is not supported, such as some EDU configurations.
  3. Handle conflicts on users. If another active user now holds the deleted user's proxy addresses or UPN, the restore call accepts autoReconcileProxyConflict or newUserPrincipalName.
  4. Restore applications before service principals. Microsoft states that restoring an application does not restore its service principal and that a service principal cannot be restored without an active application. Restoring the app registration brings back its home-tenant enterprise application settings such as consents and assignments.
  5. Restore Conditional Access in Report-only. Microsoft recommends restoring a deleted policy in Report-only mode, reviewing it, then switching it on. Restored named locations come back untrusted and need review before you mark them trusted.
  6. Watch the licence count. Restored users get their licences back even if none are available, which can leave the tenant temporarily over its purchased count.

Agent identities are now restorable objects in the same Graph API, with their own DeleteRestore permissions, so include them in the runbook if you use them. For finding and safely retiring service principals in the first place, see How to find and remove stale service principals in Entra ID, and for the object model, App Registration vs Service Principal.

Hybrid objects and the Entra Connect deletion threshold

Microsoft notes that Entra ID is not the source of authority for synced users: if the user still exists on-premises, the sync engine may restore it during the next cycle, and once the 30-day permanent deletion process has begun, a sync match can no longer bring it back. The practical order for a synced user or group is therefore AD first (Recycle Bin or authoritative restore), confirm it is in sync scope, then run a sync and confirm the soft-deleted Entra object was rematched rather than a new one created.

  • Accidental delete protection: Entra Connect is documented to stop any export with more than 500 deletes by default. A stop raises Application event 116 (source Directory Synchronization), an Entra Connect Health alert and the run profile status stopped-deletion-threshold-exceeded.
  • Review before releasing: in Synchronization Service, search the Entra connector space with scope Pending Export and Delete ticked. Microsoft says unexpected deletions usually come from OU renames or scope filter changes; fix the scope and run Start-ADSyncSyncCycle -PolicyType Initial instead of releasing the deletes.
  • Raise, do not disable: Microsoft advises raising the threshold with Enable-ADSyncExportDeletionThreshold rather than disabling it. If you must release a genuine large deletion, disable, export once and re-enable at the previous value straight away.

The sync account itself can perform mass deletes in the cloud; see How to audit the Entra Connect sync account and the Microsoft Entra Connect and Cloud Sync Hardening Guide.

Where identity fits: what to check after a service principal or service account comes back

Restoring a non-human identity restores its access, not necessarily its working state. A restored service principal keeps its properties, so check its credentials, owners and role assignments before you declare it healthy, and if the deletion was part of a compromise, rotate its secrets and certificates rather than trusting what came back. For AD service accounts restored by authoritative restore, the password reverts to the backup, so the application holding the newer password will fail until one side is reset. Group managed service accounts depend on the KDS root key and their PrincipalsAllowedToRetrieveManagedPassword group, which may itself need restoring first. See the Service Account Security Guide.

Decision guidance

SituationPreferWhy
A few AD objects, Recycle Bin onRestore-ADObject or ADACOnline, no DSRM, memberships intact
Many AD objects in one OU, Recycle Bin onFiltered Restore-ADObject by time window and lastKnownParent, parents firstAvoids restoring unrelated older deletions
AD objects, Recycle Bin off, latent GC availableAuthoritative restore of objects from the GC plus .ldf replayKeeps memberships added after the backup
AD objects, Recycle Bin off, only a backupAuthoritative restore of objects, not subtree, from system stateSmallest rollback of unrelated changes
Cloud object inside 30 daysPortal or Graph restoreSame object ID, so assignments and consents return
Cloud object hard deleted or past 30 daysRe-create from configuration exportNo native recovery exists; new object ID means re-consent and reassignment

Small organisations: enabling the Recycle Bin and keeping a scheduled export of Entra configuration covers most cases. Large or regulated estates: add a third-party AD and Entra object backup with granular restore, delegated restore rights to a small group, and quarterly drills. The Active Directory Recovery buyer's guide covers evaluation.

Detection and measurement

  • AD deletions: event 5141 (a directory service object was deleted) needs Audit Directory Service Changes and a Delete entry in the object's SACL; its Tree Delete field shows subtree deletions and Class shows the object type. Account Management auditing adds 4726 for user accounts and 4730, 4734 and 4758 for deleted security groups. See the Active Directory Security Monitoring and Event IDs Guide.
  • Entra deletions: audit log activities Delete user, Delete group and Delete application for soft deletes, and Hard delete user, Hard delete group and Hard delete application for permanent ones. Microsoft notes the log does not distinguish group types, so keep a record of which groups are security groups.
  • Sync deletions: event 116 and Connect Health alerts for threshold stops.

Metrics that show the capability works:

  1. Recycle Bin enabled in every forest (target: 100%).
  2. Time from deletion alert to verified restore in the last drill, per object type.
  3. Number of hard deletes in Entra per month outside an approved change.
  4. Soft-deleted items reviewed within 7 days of deletion (percentage).
  5. Age of the newest restorable AD backup against the deleted object lifetime.

Common failure patterns

  • Enabling the Recycle Bin after the deletion. It does not reach back; only later deletions become restorable.
  • Restoring children before the OU. Objects cannot return to a parent that is still deleted, and an ad hoc target path scatters them.
  • Using restore subtree for a single user. Every password and membership change in that OU since the backup is rolled back.
  • Forgetting the .ldf. The account returns with no memberships and users report access failures for days.
  • Restoring the app and assuming the integration works. The service principal stays deleted until restored separately through Graph.
  • Restoring a synced user in the cloud only. The next sync cycle reverses it, or a duplicate is created instead of a rematch. See Top 10 Backup and Recovery Mistakes for the wider patterns.

Framework mapping

FrameworkReferenceHow this guide applies
NIST CSF 2.0PR.DS-11, RC.RP-01, DE.CM-03Directory objects protected and tested for recovery; recovery executed from the incident process; deletions monitored
NIST SP 800-53 Rev 5CP-9, CP-10, AU-2, AU-6, CM-3Backup and reconstitution of directory objects, logging and review of deletions, change control for sync scope
MITRE ATT&CKT1531 Account Access Removal, T1485 Data DestructionMalicious deletion of accounts and directory data that this runbook reverses

Practitioner checklist

  • Enable the AD Recycle Bin in every forest and record msDS-DeletedObjectLifetime and tombstoneLifetime.
  • Document the DSRM password process and test ntdsutil authoritative restore of a single object in a lab.
  • Delegate AD and Entra restore rights to a named small group, not to every helpdesk account.
  • Keep a scripted Graph listing of deletedItems by type, ordered by deletedDateTime, ready for incidents.
  • Write the app then service principal restore order into the runbook, with a sign-in test.
  • Restore deleted Conditional Access policies in Report-only and review named locations before trusting them.
  • Keep the Entra Connect deletion threshold enabled and alert on event 116.
  • Audit 5141, 4726 and group deletion events on DCs and Entra Delete and Hard delete activities in your SIEM.
  • Export Entra configuration on a schedule for the types that are hard deleted immediately.
  • Drill a user, group, OU, app and service principal restore each quarter and record the time taken.

Standards and references

Related NHI Mgmt Group resources: Identity Recovery Guide · Active Directory Backup Strategy · Top 10 Backup and Recovery Mistakes · Entra ID Security Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.