How to Recover a Deleted Office 365 Group using PowerShell?

Requirement: Recover Deleted Office 365 Group via PowerShell.

Prerequisites: You need to have the “Azure AD 2.0, AKA Azure Active Directory PowerShell for Graph” or the latest module installed on your machine. You can check if you have the Azure Active Directory module installed by: Get-InstalledModule -Name “AzureAD*”. If you have any previous versions installed, You may have to uninstall using “Uninstall-Module AzureAD”, or for preview version “Uninstall-Module AzureADPreview” and then install the latest version using the “Install-Module AzureAD” cmdlet. More info: How to Connect to Azure AD using PowerShell?

How to Recover Office 365 Group using Exchange Admin Center?

Office 365 groups may get deleted accidentally. Luckily, we’ve methods available to recover deleted groups! If you’ve deleted an Office 365 group, it’s retained for 30 days (During this time period deleted Office 365 Groups are considered soft deleted state, as they remain restorable). After a 30-day period, the group and associated content are permanently deleted and cannot be restored.

  1. Login to Office 365 Admin center (EAC) https://admin.microsoft.com 
  2. In the left navigation, expand “Admin Center” and then click on “Exchange”
  3. In the Exchange admin center, under the “Recipients” tab, click on “Groups”. The groups tab displays the list of groups and their active status. 
  4. Select a deleted group that you want to restore, and you can view delete time info in the right pane. 
  5. Click on the “Restore” icon to recover the selected Office 365 group.
    recover office 365 group powershell

Restore Office 365 group from Microsoft 365 Admin Center or Azure AD

You can also restore a Microsoft 365 group from the Microsoft Admin Center or Azure Active Directory.

  • Microsoft 365 admin Center:
    • Login to Microsoft Admin Center https://admin.microsoft.com through the browser as Global admin >> Expand “Teams & Groups” >> Deleted Groups
    • Select the Group to Restore and click on “Restore Group”.restore deleted office 365 group
  • Azure AD:
    • Login to Azure AD Admin center https://aad.portal.azure.com >> Click on “Azure Active Directory” from the left pane.
    • Click on “Groups” >> Deleted groups
    • Select the deleted groups that are available to restore >> Click on “Restore Group” to recover the deleted group and its contents.office 365 restore deleted group

This restores the selected Microsoft 365 group content and all its associated resources such as the SharePoint Online team site, Microsoft Teams, Yammer, group mailbox, etc. to their destination and group members can access restored groups data in applications like Outlook.

Restore deleted Office 365 group using PnP PowerShell

To restore a deleted Microsoft 365 group, use this PnP PowerShell:

#Config Variables
$AdminSiteURL = "https://crescent-admin.sharepoint.com"
$GroupEmail = "[email protected]"

#Connect to PnP Online
Connect-PnPOnline -Url $AdminSiteURL -Interactive

#Get the deleted Group
$Group = Get-PnPDeletedMicrosoft365Group | Where Mail -eq $GroupEmail

If($Group -ne $null)
{
    #Restore the deleted Group
    Restore-PnPDeletedMicrosoft365Group -Identity $Group.id
    Write-host "Group Restored Successfully!" -f Green
}
Else
{
    Write-host "Could not find deleted Group!" -f Yellow
}

How to Restore Office 365 Group using Azure AD PowerShell?

To recover the deleted Office 365 group via PowerShell, follow these steps:

Step 1: Connect to Azure AD

To restore a deleted Office 365 group, Open Windows PowerShell and connect to Azure AD with the following commands:

Connect-AzureAD 

This opens the Sign page. Use your Office 365 admin account to log in to Azure AD. 

Step 2:  Get Deleted Group’s ID

Once logged in, You can retrieve the ID of the deleted group by:

Get-AzureADMSDeletedGroup 

This retrieves all deleted groups in Office 365. Note down the ID of the group you wish to restore.

Step 3: Restore Deleted Office 365 Group:

Finally, you can recover the Office 365 group by supplying the ID of the Office 365 group.

Restore-AzureADMSDeletedDirectoryObject -Id "<ObjectID>" 

This usually takes just a few minutes to complete the restore.
recover deleted office 365 group via powershell

The restoration process takes a few minutes. You can verify if the group has been successfully restored with this PowerShell command: Get-AzureADGroup –ObjectId “ID of the Group”

Salaudeen Rajack

Salaudeen Rajack - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time articles!

Leave a Reply

Your email address will not be published. Required fields are marked *