Introduction
Ever since Office 365 Groups were released which feels like many moons ago now, when it was deleted, it was unrecoverable. So if you either on purpose or accidentally deleted an Office 365 Group you lost all your data. You lost your SharePoint site, Planner data, Outlook mailbox…all of it. There was a checkbox that you had to check in most places letting you know that deletion was permanent. What began happening though with the proliferation of Groups throughout Office 365 there was a ton of ways and places to delete a Group. Last time I tried counting there was at least 16 different ways to delete a Group. That is a ton of places for UI to be just different enough and someone to make a mistake. This was also a large concern for regulated or very security aware environments. The ability to discover and recover critical data can be mandatory in these environments. That means the lack of ability to restore Groups could be a single bottle neck to stop usage of such a helpful technology.
Thankfully our wait is now no more and we can recover a deleted Office 365 Group. The message that this was rolling out appeared in Message Centers today and the Office 365 Roadmap has already been updated that this has been launched.
Here is the announcement on the Tech Community site and the supporting Microsoft Documentation.
NOTE: I am writing this right around the launch date of this feature and will try to keep this post updated if anything changes
What you need to know
- Currently you can only recover them via PowerShell with GUI coming later
- You have 30 days from the deletion of the Group to recover it, if not it will be permanently deleted
- You cannot restore a group if a group with the same SMTP address or alias now exists (that new group would have to be deleted first)
- It could take up to 24 hours to restore in rare cases
- You can permanently delete a Group within the 30 days
- Content that currently gets restored includes:
- AD Groups Object including properties and members
- SMTP address
- Exchange mailbox & calendar
- SharePoint Online site
- OneNote notebook hosted on the SPO site
- Planner
- Additionally if you have a connected Microsoft Team or Office 365 Connected Yammer group those can be restored as well
Prerequisites:
- Azure AD PowerShell V2 – Preview
- The release of the cmdlets that support Office 365 Group recovery are now available only in the preview cmdlets.
- I am writing this using version 2.0.0.98
Steps to recover a deleted Office 365 Group
In my example I have a Group called InterestGroup1 which was deleted and can no longer be seen:
1 – Connect to Azure AD via PowerShell (ensure you connect to Preview)
Connect-AzureAD
2 – Review the Office 365 Groups that have been deleted and can be recovered
I included the list of properties in this for visibility to see everything returned in the recoverable Group object. You only need Get-AzureADMSDeletedGroup, ” | select * ” is not required.
Get-AzureADMSDeletedGroup | select *
3 – Select the Group you want to recover and ensure that you selected a group
Replace “ENTER GROUP DISPLAY NAME HERE” with the appropriate name of the Group you want to recover. I put this together so you just need to enter the Group Display Name instead of copying the GUID but entering just the ID is also valid in the next step.
$deletedgroup = Get-AzureADMSDeletedGroup | Where-Object {$_.DisplayName -eq "ENTER GROUP DISPLAY NAME HERE"} $deletedgroup
4 – Recover your Group
Restore-AzureADMSDeletedDirectoryObject –Id $deletedgroup.Id
You can run the command from step 2 above to review that your Group you are recovering is no longer in the Deleted Group list.
5 – Confirm you Group has been recovered
Get-AzureADGroup
After some time it will start popping back up in the GUI.
Steps to permanently delete an Office 365 Group
You can also delete a Group that is in the pending 30 day deletion using this process. This will delete everything and not be recoverable.
1 – Follow steps 1 through 3 above to connect to Azure AD and get the group you want to recover in the $deletedgroup variable.
Instead of using the Restore-AzureADMSDeletedDirectoryObject cmdlet use the Remove-AzureADMSDeletedDirectoryObject cmdlet and passing the Group ID.
Remove-AzureADMSDeletedDirectoryObject –Id $deletedgroup.Id
2 – Review the Office 365 Group has been deleted
Get-AzureADMSDeletedGroup | select *