If you've deleted an Office 365 group, by default it's retained for 30 days. The group, which we refer to as "soft-deleted" during that 30 days, can be restored by using PowerShell.
You can also permanently delete a soft-deleted group if you can't wait the 30 days for the retention period to expire for the content to be permanently deleted.
IMPORTANT: If you use Remove-MsolGroup in PowerShell to delete a group, this will purge the group permanently. When using PowerShell to delete groups, it's best practice to use Remove-AzureADMSGroup to soft-delete the O365 group. That way you can get it back if needed.
Install the preview version of the Azure Active Directory Module for Windows PowerShell
IMPORTANT: The procedures in this article require the PREVIEW version Azure Active Directory Module for Windows PowerShell, specifically, the AzureADPreview module, version 184.108.40.206 or later.
As a best practice, we recommend always staying current: uninstall the old AzureADPreview version and get the latest one before you run PowerShell commands.
Open Windows PowerShell as an administrator:
In your search bar, type Windows PowerShell.
Right-click on Windows PowerShell and select Run as Administrator.
The Windows PowerShell window will pop open. The prompt C:\Windows\system32 means you opened it as an administrator.
To uninstall a previous version of AzureADPreview, run this command:
To install the latest version of AzureADPreview, run this command:
At the message about an untrusted repository, type Y. It will take a minute or so for the new module to install.
Restore a deleted group
Did you install the AzureADPreview module, as instructed above? Not having the most current preview version is the #1 reason these steps don't work for people.
If you haven't already, open a Windows PowerShell window on your computer (it doesn't matter if it's a normal Windows PowerShell window, or one you opened by selecting Run as administrator).
Run this command:
In the Sign in to your Account screen that opens, enter your credentials to connect you to your service, and click Sign in.
Run this command to display all soft-deleted Office 365 groups in your organization that are still within the 30 day retention period:
Take note of the object ID of the group, or groups, you want to restore. If you don't see the group you're looking for on this list then it has likely been purged permanently.
Caution: If a new group has been created with the same alias or SMTP address as your deleted group, you will have to delete that new group before you'll be able to restore your deleted group.
To restore that group run this command:
Restore-AzureADMSDeletedDirectoryObject –Id <objectId>
This process usually takes just a few minutes but in a few rare cases it can take as long as 24 hours to completely restore. To verify that the group has been successfully restored, run this command in PowerShell:
Get-AzureADGroup –ObjectId <objectId>
Once the restore has successfully completed, the group should reappear on the navigation pane in Outlook and Outlook on the web and all restored content, including SharePoint and Planner, should be available to the group members again.
Group content that can be restored includes:
Azure Active Directory (AD) Office 365 Groups object, properties and members
Group SMTP address
Exchange Online shared inbox and calendar
SharePoint Online team site and files
Additionally if you have a connected Microsoft Team or Office 365 Connected Yammer group, those can be restored as well.
Permanently delete a group
Sometimes you may want to permanently purge a group without waiting the 30 days for the soft-delete to expire. To do that start PowerShell and run this command to get the object ID of the group
Take note of the object ID of the group, or groups, you want to permanently delete.
Caution: Purging the group removes the group and its data forever.
To purge the group run this command in PowerShell
Remove-AzureADMSDeletedDirectoryObject –Id <objectId>
To confirm that the group has been successfully purged, run the Get-AzureADMSDeletedGroup cmdlet again to confirm that the group no longer appears on the list of soft-deleted groups. In some cases it may take as long as 24 hours for the group and all of its data to be permanently deleted.
Got questions about Office 365 Groups?
Visit the Microsoft Tech Community to post questions and participate in conversations about Microsoft Office 365 Groups.
This article was last updated on 6 July, 2017 as a result of your feedback. If you found it helpful, and especially if you didn't, please click the feedback controls below and leave us some constructive comments so we can continue to improve it. Thanks!