There are a few ways to create Office 365 Groups. You can create a group individually in the Admin Center, but they also get generated automatically when you create a Team in Microsoft Teams and the new Modern SharePoint Team site. This blog will walk through some aspects of how to manage those groups and show how to restore and delete Office 365 groups.
In Office 365, when a group is deleted (Remove-AzureADMSGroup), the default retention period is 30 days. During this period, the Group remains in a Soft Delete state. This allows for administrators to restore the group, if necessary. However, there is a command available if you wish to permanently remove the group.
Connect to Azure AD with PowerShell
Before connecting to Azure AD with PowerShell, be sure the AzureAD PowerShell Module is installed on your machine (a link to Microsoft’s documentation is included in the references section at the end of this post).
Now you’re ready to connect to Azure AD. Connecting to Azure AD will prompt you for credentials. If the connection is successful, you’ll see some basic information about your tenant.
Get Soft-Deleted Groups
Now that you’re successfully connected to your tenant, you want to get a listing of the O365 groups that are in a Soft Delete state.
Restore Deleted Groups
If you wish to restore a given group, run the following command, using the ID from the command above.
Restore-AzureADMSDeletedDirectoryObject -Id <objectId>
Permanently Delete Group(s)
If you wish to bypass the 30-day Recycle Bin waiting period, and permanently delete the group, run the following command:
Remove-AzureADMSDeletedDirectoryObject –Id <objectId>
Run the Remove command, along with the ID of the Group you want to delete. Successful execution will not return any results. Run the Get-AzureADMSDeletedGroup command again to validate that your group is no longer in a Soft Delete state, and was, in fact, deleted.
Finally, if your organization needs help with any aspect of Office 365, please reach out to us. We’d love to help you get started.