Introduction
The ability for soft-delete and restore of an Office 365 Group has recently been released. I put together some information about that in my previous post here. Before this restoration was possible, when you deleted an Office 365 Group it was fully gone. Now we have the ability to view Groups that have been deleted and restore them using PowerShell.
The ability to restore was a great but there was a small gap for me when the cmdlets were first rolled out:
- You have 30 days to restore an Office 365 Group but you didn’t know when an Office 365 Group was deleted.
This would make building any logic around things like notifications or reporting a challenge as we could not tell which Groups were about to expire.
This has been resolved by Microsoft and we now have the ability to see the Deleted Date and Time of an Office 365 Group for the 30 days it is retained using PowerShell.
What you need to know
- You can only view the deletion date via PowerShell
- You can only view the deletion date of Groups that are in the pending permanent delete state that stays around for 30 days
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.110
Viewing when an Office 365 Group was deleted
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 when they were deleted
This will sort the Groups by their DeletedDateTime
Get-AzureADMSDeletedGroup | Sort-Object DeletedDateTime | Format-Table DisplayNAme, DeletedDateTime, Description, Visibility, Mail, ID
You are now good to go build something fancy like:
- Build a report for admins to notify them weekly what Groups are being permanently deleted
- Build a single page app to surface deleted Groups and allow users to recover them using an Azure Function