Restoring Deleted Microsoft 365 Groups and Microsoft Teams with PowerShell

[!IMPORTANT] Cloud Modernization Notice (2026): The preview cmdlets Get-AzureADMSDeletedGroup and Restore-AzureADMSDeletedDirectoryObject have been retired along with the AzureAD module. This article has been updated with modern, supported Microsoft Graph PowerShell SDK cmdlets (Get-MgDirectoryDeletedItemAsGroup & Restore-MgDirectoryDeletedItem). Historical AzureAD commands are preserved below for reference.

When a Microsoft 365 Group or a Microsoft Team is deleted, it is not permanently purged immediately. Microsoft Entra ID retains the group in a soft-deleted state for 30 days. During this 30-day recovery window, administrators can restore the group and its associated resources—including the SharePoint site collection, Team channels, Planner boards, conversations, and OneNote notebooks.

In this guide, we review how to restore soft-deleted groups and Teams using both the modern admin centers and the Microsoft Graph PowerShell SDK.

---

What Happens During Group Soft-Delete?

When an M365 Group or Team is deleted:

  • The group object in Entra ID is marked as soft-deleted.
  • The linked SharePoint site collection is moved to SharePoint Online Recycle Bin.
  • Mailbox items, conversations, and calendar items are preserved in the Exchange Online Substrate.
  • After 30 days, the group and all associated services are permanently and irrevocably deleted.
---

Method 1: Modern Admin Center GUI

1. Open the Microsoft 365 Admin Center (admin.microsoft.com). 2. In the navigation pane, expand Teams & groups > Deleted groups. 3. Select the deleted group or team you wish to recover. 4. Click Restore group. 5. The restore initiates immediately. SharePoint sites and Exchange mailboxes reconnect within minutes.

(Note: While the group and mail flow recover almost immediately, full synchronization back into the desktop Microsoft Teams client can take up to 2-24 hours depending on client caching.)

---

Method 2: Modern PowerShell with Microsoft Graph SDK

Using Microsoft Graph PowerShell is the most reliable method for automated recovery or bulk inspection.

Prerequisites

Connect to Graph with group administrative permissions:

POWERSHELL
# Install the Identity Directory Management module if needed
Install-Module Microsoft.Graph.Identity.DirectoryManagement -Scope CurrentUser -Repository PSGallery -Force

# Connect with required directory read/write scopes
Connect-MgGraph -Scopes "Group.ReadWrite.All", "Directory.ReadWrite.All"

---

Step 1: List All Soft-Deleted Groups

Use Get-MgDirectoryDeletedItemAsGroup to list all groups currently held in the 30-day recovery window:

POWERSHELL
# List all soft-deleted groups with deletion timestamp
Get-MgDirectoryDeletedItemAsGroup -All | Select-Object Id, DisplayName, Mail, DeletedDateTime | Format-Table -AutoSize

Sample output:

TEXT
Id                                   DisplayName   Mail                     DeletedDateTime
--                                   -----------   ----                     ---------------
fe8268cc-40c8-499b-9ee9-cdc5d7e02624 Project Alpha [email protected]     2026-11-01T14:22:10Z
81bc17a1-30ef-4f12-a890-48e02d9bb933 Dev Support   [email protected] 2026-11-02T08:15:33Z

---

Step 2: Search for a Specific Deleted Group

If you have many deleted objects, filter by name:

POWERSHELL
$targetGroupName = "Project Alpha"
$deletedGroup = Get-MgDirectoryDeletedItemAsGroup -All | Where-Object { $_.DisplayName -eq $targetGroupName }

if ($deletedGroup) {
    Write-Host "Found deleted group ID: $($deletedGroup.Id)" -ForegroundColor Green
} else {
    Write-Warning "Deleted group '$targetGroupName' was not found or has exceeded the 30-day purge window."
}

---

Step 3: Restore the Soft-Deleted Group (Restore-MgDirectoryDeletedItem)

To restore the group, supply its directory Id to Restore-MgDirectoryDeletedItem:

POWERSHELL
$groupId = "fe8268cc-40c8-499b-9ee9-cdc5d7e02624"

# Restore the directory object
Restore-MgDirectoryDeletedItem -DirectoryObjectId $groupId

Write-Host "Successfully restored group ID: $groupId" -ForegroundColor Green

---

Step 4: Verify Restoration

Verify that the group has returned to the active directory pool:

POWERSHELL
# Confirm group is active in Entra ID
Get-MgGroup -GroupId $groupId -Property "Id", "DisplayName", "Mail", "GroupTypes"

# If the group is a Microsoft Team, verify Teams status
Get-Team -GroupId $groupId

---

Archival Reference: Legacy AzureADPreview Method

Click to view historical commands using the retired AzureADPreview module

Connect:

POWERSHELL
Connect-AzureAD

Query deleted groups:

POWERSHELL
Get-AzureADMSDeletedGroup

Restore deleted group:

POWERSHELL
Restore-AzureADMSDeletedDirectoryObject -Id fe8268cc-40c8-499b-9ee9-cdc5d7e02624

---

Need to monitor when groups or teams are deleted in your tenant? Check our guide on Fetching Microsoft Entra Sign-In and Audit Logs with PowerShell.