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 the 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?
It’s not uncommon for Microsoft 365 groups to be accidentally deleted, causing disruptions to communication within the organization. Fortunately, we have Microsoft 365 admin center and PowerShell methods available to recover deleted groups! In this article, we will outline the steps to restore a deleted group in Office 365.
How to Recover Office 365 Group using Exchange Admin Center?
If you’ve deleted an Office 365 group, it’s retained for 30 days (During this period, deleted Office 365 Groups are considered a soft deleted state, as they remain restorable). After 30 days, the group and associated content are permanently deleted and cannot be restored. Follow these steps to restore deleted groups, such as the Distribution list, Microsoft 365 group, etc., from the Exchange Online admin center:
- Login to Office 365 Admin center (EAC) https://admin.microsoft.com
- In the left navigation, expand “Admin Center” and then click on “Exchange”
- In the Exchange admin center, under the “Recipients” tab, click on “Groups”. The Groups tab displays the list of groups and their active status.
- Select a deleted group you want to restore, and you can view the delete time info in the right pane.
- Click on the “Restore” icon to recover the selected Office 365 group.
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
- The group will now be restored and will be visible in the “Active groups” list.
- Select the Group to Restore and click on “Restore 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.
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 group data in applications like Outlook. BTW, if the group was deleted more than 30 days ago, restoring a deleted group may not be possible, so it’s important to have a backup and recovery plan in place to help prevent data loss.
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 = "retailmgrus@crescent.com"
#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
}
Once you run this script, the deleted Office 365 group will be restored with the specified settings. Note that it may take some time for the group to become active and for users to use the restored group.
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.
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”
Conclusion
In conclusion, restoring deleted groups in Office 365 is a simple and straightforward process that can be accomplished using any of the methods explained in this article. Whether you accidentally deleted a group or need to retrieve a deleted group for legal or compliance reasons, the steps outlined in this guide allow you to restore the group and regain access to its content and membership. Accidentally deleted groups in Office 365 can cause disruptions to communication within an organization. However, Office 365 administrators can easily restore deleted groups. By following the simple steps outlined in this article, you can quickly restore any deleted groups and ensure that communication within your organization remains streamlined and efficient.
Unfortunately, You can’t! Distribution lists don’t support restoration. So, you have to create a new distribution list with the members from the existing one!