Partager via


Restore a Deleted Team in Microsoft Teams

Introduction

When working within Microsoft Teams, owners of teams have the capability of deleting a team, and sometimes these teams may be accidently deleted. When the team is deleted, it is held in the "recycle bin" for 30 days until it is permanently deleted. This blog post will walk an IT administrator through the process of restoring a deleted team in Microsoft Teams.

Step 1: Create a Team in Microsoft Teams

Create a new team in Microsoft Teams titled Project Del Mar:

Create additional tabs w/ content (including OneNote and Planner tasks), as an example:

Create sample files and folder content under the Files tab:

Create sample chat content under the Conversations tab:

Step 2: Delete the Team in Microsoft Teams

From within Microsoft Teams, right click the name of the team and select Delete Team. In the dialog box, select I understand that everything will be deleted and then click the button Delete Team.

Notice the team is now deleted and no longer appears in the list of teams you subscribe to:

Step 3: Restore the Deleted Team:

Launch PowerShell as an administrator. Note, at the time of this writing, this restore procedure requires the AzureADPreview module to be installed. To install, simply type Install-Module AzureADPreview and follow the prompts.

IMPORTANT: When a team is created in Microsoft Teams, it creates an Office 365 group. This procedure is the process for restoring an Office 365 group and is documented in more detail here.

Connect to Azure AD by typing the following command:

Connect-AzureAD

When prompted, sign in:

Once you are signed in, you will see the following:

Display all deleted Office 365 groups by typing the following command:

Get-AzureADMSDeletedGroup 

Note: Use -All $True if you have a lengthy list of groups.

Example:

Find the group you wish to restore, and copy the id from the Id column to the clipboard. Next, to restore the deleted group type the following where [ID] is the Id of the group and press Enter:

Restore-AzureADMSDeletedDirectoryObject -Id [ID]

Example:

Verify group was restored successfully by typing the following command, where [ID] is the ID of the group you restored:

Get-AzureADGroup -ObjectId [ID]

Example:

Important: The process of restoring an Office 365 group and thus restoring the team in Microsoft Teams can take up to 24 hours.

After waiting up to 24 hours, return to Microsoft Teams. Note, the team will be displayed in the list of teams you subscribe to, and all existing content within the tabs, including conversations will be restored successfully. This also includes channels as well.

Example:

Comments

  • Anonymous
    July 24, 2017
    Nice guide man. It would be interesting to see if someone could integrate part 3 (restore the deleted team) as a trigger to a monitor looking for accidentally deleted teams. Like have a synthetic test / monitor that checks your teams via the api then restores the team if it is missing from the list.
    • Anonymous
      July 24, 2017
      Agreed. You could script this in PowerShell and set it up to run in SCOM if you like. Lot's of possibilities here.
  • Anonymous
    September 06, 2017
    Nice guide, thank you.What's the procedure, if the non-deleted team-site should be restored?
    • Anonymous
      September 06, 2017
      Can you please describe the scenario in more detail?
      • Anonymous
        September 07, 2017
        Hi Matt,the scenario: Some important Files were deleted, Recycle Bins are purged manually by third person... is it possible to restore the (whole) team site by powershell? Do o365-admin has access to backups are made by Microsoft?Or should I open the Microsoft support case in this situation, of any backups are made at all?Thanks
  • Anonymous
    October 06, 2017
    LIFE SAVER! Thank you
  • Anonymous
    January 03, 2018
    This is an absolute lifesaver.
  • Anonymous
    December 05, 2018
    Hi Matt,Just tried this and the process is still good. Thank you for posting.
  • Anonymous
    March 29, 2019
    Hello Matt. Thanks for your guide. Is it possible to move channels within teams? Thank you.
  • Anonymous
    April 05, 2019
    Didn't work for me, even 24 hr later (2 weeks to be exact).The Office 365 group was restored successfully, I can access the SPO site, conversations within the group, etc, but the Team was never shown on MS Teams, and in the Microsoft Teams Admin Center I see the Team but with the warning "We can't load complete information about this team. Please refresh or try again after some time". I have done the same with several Teams and I got the same issue.
  • Anonymous
    April 11, 2019
    As an update, it looks like permanent documentation on this process is stored here: https://docs.microsoft.com/en-us/office365/admin/create-groups/restore-deleted-group?view=o365-worldwideFrom the doc, "When a[n O365] group is restored, the following content is restored: 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, OneNote notebook, Planner, Teams, Yammer group and group content (If the Office 365 group was created from Yammer)"