How to Recover a Deleted Office 365 Group using PowerShell?
Requirement: Recover Deleted Office 365 Group via PowerShell.
Groups play a crucial role in collaboration, communication, and resource sharing within an organization. However, 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.
Table of contents
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?
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.
- You can view the delete time information in the right pane after selecting a deleted group you want to restore.Â
- 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.
Recover from the Microsoft 365 Admin Center
The most straightforward method to recover a deleted Office 365 group is through the 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”.
The group will be restored, along with all its associated resources and members.
Restore Deleted Group from the Azure AD
- Login to Azure AD Admin center https://aad.portal.azure.com >> Click “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. To recover a group using PowerShell, you need administrative access to your Office 365 tenant.
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 the 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”. Recovering a deleted Office 365 group via PowerShell can be more flexible, allowing for batch operations and more.
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.
To restore a deleted Office 365 group from the Recycle Bin, follow these steps: Log in to the Microsoft 365 admin center. Navigate to the “Groups” section. Click on the “Deleted groups” tab. Locate the group you want to restore and click on the “Restore group” button.
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!
Deleted Office 365 Groups are retained for 30 days in a “soft deleted” state, allowing for restoration during this period. After the 30-day retention period, the deleted Office 365 Groups and their associated contents are permanently deleted and cannot be restored (Unless you have a backup mechanism in place).
No, only Microsoft 365 Groups can be restored after deletion. Security groups and distribution groups cannot be restored once deleted.
Global administrator, Group administrator, and Intune administrator can restore any deleted Microsoft 365 Group. Regular users can restore any deleted Microsoft 365 Group that they own.
To restore a deleted Microsoft 365 Group using PowerShell, you can use cmdlets like Get-AzureADMSDeletedGroup to view deleted groups and Restore-AzureADMSDeletedDirectoryObject to restore a specific group.
When you restore a deleted Office 365 group, all its associated resources, such as the shared mailbox, calendar, SharePoint site, and OneNote notebook, are also restored. The group members are also added back to the group.