When a user is deleted in Office 365, their account can be restored within 30 days before permanent deletion. Restoring a deleted user recovers their email, OneDrive files, and other associated data. This guide explains how to restore a user via the Microsoft 365 Admin Center and PowerShell.
Requirements
- Admin access to the Microsoft 365 Admin Center or Exchange Online PowerShell.
- The user must have been deleted within the last 30 days to be recoverable.
Method 1: Restore a Deleted User via Microsoft 365 Admin Center
Step 1: Log into the Admin Center
- Open a browser and go to https://admin.microsoft.com.
- Sign in with your administrator credentials.
Step 2: Navigate to Deleted Users
- In the left-hand menu, click Users > Deleted users.
- Locate the user you want to restore.
Step 3: Restore the User Account
- Click on the user’s name to open their profile.
- Click Restore user.
- If prompted, assign a new password or reset the existing one.
Step 4: Assign Licenses (If Required)
- If the user was assigned a license before deletion, Office 365 will attempt to restore it.
- If no licenses are available, you must purchase or reassign one.
📌 Note: It may take a few minutes for the user’s data and access to be fully restored.
Method 2: Restore a Deleted User via PowerShell
For larger organizations, PowerShell is a faster way to restore users in bulk.
Step 1: Connect to Microsoft Entra ID PowerShell
- Open PowerShell on your computer.
- Run the following command to connect to Microsoft Entra ID (Azure AD):powershellCopyEdit
Connect-MgGraph -Scopes "User.ReadWrite.All"
- Authenticate using your admin credentials when prompted.
Step 2: List Recently Deleted Users
To see all deleted users that are still recoverable, run:
Get-MgDirectoryDeletedUser
Step 3: Restore a Specific User
To restore a specific user, run:
Restore-MgDirectoryDeletedUser -UserId "[email protected]"
Step 4: Verify the Restoration
After restoring, confirm the user is active by running:
Get-MgUser -UserId "[email protected]"
What Happens After Restoring a User?
- The user will regain access to their email, OneDrive files, and assigned licenses.
- Group memberships and permissions may need to be reconfigured.
- If the user’s data was transferred to another user before deletion, it will not be automatically restored.
How to Permanently Delete a User (Before 30 Days Expire)
If you want to permanently delete a user before the 30-day retention period expires:
Using Admin Center:
- Go to Admin Center > Users > Deleted users.
- Select the user and click Permanently delete.
Using PowerShell:
Run the following command:
Remove-MgDirectoryDeletedUser -UserId "[email protected]"
📌 Warning: This action is irreversible!
Best Practices
✅ Monitor Deleted Users – Regularly review deleted users to ensure no accidental removals.
✅ Use Role-Based Access Control – Limit who can delete users to prevent accidental data loss.
✅ Back Up User Data – Consider using third-party backup tools for extra data protection.