Home

New feature: Recover deleted Office 365 Group via PowerShell

Christophe Fiessinger
Microsoft

New feature: Recover deleted Office 365 Group via PowerShell

If you've deleted an Office 365 group, it's now retained by default for a period of 30 days. Within that period, you can now restore the group and its associated apps and data via a new PowerShell cmdlet.  For additional information please go to https://aka.ms/groupssoftdelete.

 

RestoreGroup.JPG

46 Replies

Re: New feature: Recover deleted Office 365 Group via PowerShell

woot!

 

Is there a way for admins to know if/when an Office 365 Group is deleted?

Re: New feature: Recover deleted Office 365 Group via PowerShell

you can now write a script that notifies you on a regular basis for instance using this new cmdlet: 

 

Get-AzureADMSDeletedGroup | Sort-Object DisplayName| Format-Table Id, DisplayName, Description, Visibility

Re: New feature: Recover deleted Office 365 Group via PowerShell

Finally, thanks for the update!

Re: New feature: Recover deleted Office 365 Group via PowerShell

Awesome stuff!!!

Re: New feature: Recover deleted Office 365 Group via PowerShell

Thank you!!!!! When restoring a group will any data (Sharepoint Document Libraries) associated with the group be restored as well?
Highlighted

Re: New feature: Recover deleted Office 365 Group via PowerShell

Excellent! ty.

Re: New feature: Recover deleted Office 365 Group via PowerShell

it does as mentioned in the document referred above:
"Group content that can be restored includes: (...) SharePoint Online team site and files"

Re: New feature: Recover deleted Office 365 Group via PowerShell

Great news! Is it planned to know how long Groups have left in the recoverable state be available via these cmdlets?

Re: New feature: Recover deleted Office 365 Group via PowerShell

From the documentation:

"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."

Re: New feature: Recover deleted Office 365 Group via PowerShell

Yes I saw the 30 days but when looking at a soft deleted Group you currently cannot see how many days it has left before permanent deletion or when it was deleted. I was just curious if this is something currently being talked about to surface through the supporting cmdlets. I believe I can get it through the audit log if needed.

Re: New feature: Recover deleted Office 365 Group via PowerShell

@Brent Cordis try this script

https://practical365.com/collaboration/groups/powershell-script-generate-reports-groups-office-365/

 

We'll be updating it to flag whether deleted groups are still recoverable as well, now that the new feature is available.

cc @Christophe Fiessinger

Re: New feature: Recover deleted Office 365 Group via PowerShell

Awesome news, glad you finally relased this feature! Some more information on what happens when you soft-delete a group might be useful, for example can the group still receive mail, what happens if some group content is on hold (i.e. how it is handled in respect to all workloads; what happens if you try to hard-delete), etc.

Re: New feature: Recover deleted Office 365 Group via PowerShell

Cool thanks for this great news

Re: New feature: Recover deleted Office 365 Group via PowerShell

Drew we will expose in a few weeks the deleted date/time property of each object, please stay tune.

Re: New feature: Recover deleted Office 365 Group via PowerShell

@Christophe Fiessinger I've been testing this and there seems to be some inconsistency, or perhaps just delays in how the restoration is processed in the back end.


The issues I'm noticing are:

  • The Group owner/admin who deletes the Group is not included as a member when the Group is restored. In one case I had to go through the process of requesting to join, then approving my own request, to get back into the Group.
  • Some public Teams that have been restored are unable to be joined by others afterwards.

It's inconsistent though. Two Teams (one private, one public, both with an admin and a single non-admin member) were deleted and restored without issue. Meanwhile others that I restored over an hour ago are still unable to be joined.

 

I haven't noticed any issues within Outlook or Planner though (other than the cases where the admin wasn't restored), this is all Teams issues.

 

Edit: eventually it seems they've come good again. Is everything I saw there just the expected/possible delay of up to 24 hours for the full restoration process to complete?

Re: New feature: Recover deleted Office 365 Group via PowerShell

Wow Paul, thanks for sharing your tests...it seems the feature might have some problems and I also will try to find some time to test it and confirm your results

Re: New feature: Recover deleted Office 365 Group via PowerShell

@Juan Carlos González Martín see my edited post above. Might not be anything more than just a delay with some of the apps being fully restored. Bit of a rough experience overall.

Re: New feature: Recover deleted Office 365 Group via PowerShell

Agree, and I would like to know if that it's the case...to me it makes sense taking into account what we know about delays when creating Groups from different sides...for instance the highest delay I'm currently seeing is the one that happens between you create a modern team site and you have the EXO inbox created

Re: New feature: Recover deleted Office 365 Group via PowerShell

I've been testing with this (long awaited) feature and when I restore a deleted group, it doesn't re-appear in my Outlook 2016 client nor in the web client

 

When I search the group in the web client, I'm able to find and access it but it still won't show up in my list of groups...

 

It has been approx 24 hours since I restored the group btw. 

 

Am I missing something?

Re: New feature: Recover deleted Office 365 Group via PowerShell

@Ronald Knaap during my testing I noticed delays as well. In my case the user got a "Something has changed etc etc and you must restart Outlook" popup. After restarting Outlook the Groups appeared.

Re: New feature: Recover deleted Office 365 Group via PowerShell

I've restarted Outlook several times but still no restored group so far. 

 

Maybe it's a matter of time

 

Which is our slogan with Office 365 the last few months.. If something doesn't work...

"It's a matter of time!" :) 

 

And most of the times... it is :)

Re: New feature: Recover deleted Office 365 Group via PowerShell

I guess it makes sense, considering the model Groups use to "signal" the different workloads. It's a very good idea to note this in the documentation, maybe with somewhat bigger letters :)

Re: New feature: Recover deleted Office 365 Group via PowerShell


Ronald Knaap wrote:

 

Which is our slogan with Office 365 the last few months.. If something doesn't work...

"It's a matter of time!" :) 

Many Office 365 problems are solved by just waiting longer.

Re: New feature: Recover deleted Office 365 Group via PowerShell

I just needed the restore for a group which is being used in a production environment. I did the restore 15 min ago and the timeline of the conversations is already back(this took like 5 min).

 

It is only taking some more time to restore the Onenote and SharePoint data. Are there any insights on how long it will take before everything is restored. Or is this the delay part, what i am waiting for now?

Re: New feature: Recover deleted Office 365 Group via PowerShell

@Christophe FiessingerWhen i now navigate to the group from outlook web. I get in the group. Only when i go to files i get. the message: That there is no data and that i can start using the area. When i navigate to the Library i get an 403 error page cannot be found. Does this means it is still restoring?

Re: New feature: Recover deleted Office 365 Group via PowerShell

From the documentation mentioned above:

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.

Re: New feature: Recover deleted Office 365 Group via PowerShell

Well, it looks like it's a problem on my client because I restored a group which my colleague removed yesterday and it reappeared in his Outlook client.. (after a restart of the client) 

 

Or it has something to do with the groups because I (mis)used them a lot for testing ;)

Re: New feature: Recover deleted Office 365 Group via PowerShell

Not sure what you did but as usual if it feels like a bug please reach our support channel to get it handled properly.

Re: New feature: Recover deleted Office 365 Group via PowerShell

The restore is completed so it took arround 10 min to restore the Conversations and 6 hours to restore +/-350 GB of data in SharePoint.

 

Anyways the restore works just perfect :) Thanks for making this feature available!

Re: New feature: Recover deleted Office 365 Group via PowerShell


Christophe Fiessinger wrote:

From the documentation mentioned above:

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.


I think you should reword that. The "few minutes" hasn't been true for any of my test cases so far.

 

Also, the Group appears in the Get-AzureADGroup output (indicating it's been restored successfully) long before all the content in different apps is available.

 

And also, the Group appears in the Outlook navigation pane long before all the content in different apps is available.

 

Perhaps a more accurate wording would be to say that the Get-AzureADGroup output or the appearance in Outlook confirms that the restore has *started*, and that it may process for several hours before all services are available again. That would set expectations better than the current wording.

Re: New feature: Recover deleted Office 365 Group via PowerShell

I totally agree with that. In the time between the success from the command in powershell and the time the restore is actually completed it would be great to see some kind of progress so you know what you are dealing with.
This would be a great addition to the script because if one half of the restore is complete and the other half gives you a 403 error. I was wondering if my data would be restored.

Re: New feature: Recover deleted Office 365 Group via PowerShell

I installed Online Services Sign-In Assistant and AzureADPreview 2.0.0.98 on Windows 10 and connected to Azure AD with our tenant admin account, but when I execute Get-AzureADMSDeletedGroup cmdlet I receive the error;

The term 'Get-AzureADMSDeletedGroup' is not recognized as the name of a cmdlet, function, script file, or operable program.
Do I need antoher version of the AzureADPreview or am I missing a prerequisite?

 

 

Re: New feature: Recover deleted Office 365 Group via PowerShell

Hi Paul,

 

The 'Get-AzureADMSDeletedGroup' cmdlet is part of AzureADPreview 2.0.0.98 so you should be able to use it if you installed this module. Can you please verify that the module has been installed correctly? You can use "Get-Module AzureADPreview" for that.

If you have installed the correct module on your computer you should be able to use the cmdlet. Please let me know if it still doesn't work.

 

-Rob

Re: New feature: Recover deleted Office 365 Group via PowerShell

Hi Rob,

 

Thanks for your reply.
I just got it working, but don't know what the issue was.
On Win10 and Server2012R2 the AzureADPreview module installed, but Get-Module AzureADPreview showed no result.
On server2008R2 it works. I first installed the PackageManagement PowerShell Modules and the Online Services Sign-In Assistant and that executed Install-Module -Name AzureADPreview.
The same steps didn't work on Win10 and Server 2012R2.

Do you know if there is a log where I can find Install-Module errors?

 

Re: New feature: Recover deleted Office 365 Group via PowerShell

@Drew Madelung if you get the lastest module you will see a new property exposed: DeletedDateTime as shown belowGet-AzureADMSDeletedGroup | Sort-Object DisplayName| Format-Table Id, DisplayName, Description, Visibility, DeletedDateTimeGet-AzureADMSDeletedGroup | Sort-Object DisplayName| Format-Table Id, DisplayName, Description, Visibility, DeletedDateTime

Re: New feature: Recover deleted Office 365 Group via PowerShell

Re: New feature: Recover deleted Office 365 Group via PowerShell

This is Great News! well done

Re: New feature: Recover deleted Office 365 Group via PowerShell

I tested the restore process and found that everything came back pretty quickly.  I could access the restored Group in Outlook on the Web almost immediately.  The SharePoint Team Site took a little longer to restore, maybe 5-10 minutes later.

 

The only service that hasn't restored yet is Teams.  Do we have to wait even longer for Teams?  I re-connected Teams to the Group to see if the content was there, it was not.  Should the Team automatically reconnect to the Group after restore?  Will it still restore the content even after I've re-connected Teams to the Group?

Re: New feature: Recover deleted Office 365 Group via PowerShell

Teams will also be restored, This will take about the same amount of time as the SharePoint Library

Re: New feature: Recover deleted Office 365 Group via PowerShell

I've tested this and yes the group and files have restored but not the team I had setup in teams

the size of the group was tiny, probably only 2mb worth of files.

Does it just generally take quite a while for a teams team recreate itself?

RE: New feature: Recover deleted Office 365 Group via PowerShell

My test team doesnt appear to have restored. For this to work and when creating a team is there a pre-requisite of a group for that team already existing? Therefore, (1) create group first and then (2) create team and link it to that group - then when you do the restore it restores the team? Seems long-winded but if that's the solution then that's OK.

Re: RE: New feature: Recover deleted Office 365 Group via PowerShell

Chris it should have been restored, please contact support to get this investigated further.

Re: New feature: Recover deleted Office 365 Group via PowerShell

Hi Chris,

 

Once the 30 days is over, I understand that the group will be purged. 

 

Is it still possible to submit a help ticket to Microsoft within 14 days after 30 days to have it recovered? 

 

Kind Regards

Vincent Ha

Re: New feature: Recover deleted Office 365 Group via PowerShell

 installed AzureADPreview 2.0.0.127 and Windows management Framework 5.0 on windows 7 64bit.   But when I run Get-AzureADMSDeletedGroup, I get "The term 'Get-AzureADMSDeletedGroup' is not recognized as the name of a cmdlet, function, script file, or operable program.  Do I need to install anything else in order to run this PowerShell?

Thanks.

 

Akiko

Re: New feature: Recover deleted Office 365 Group via PowerShell

Is it possible to restore a group if the domain name of the group has been removed from the tenant since deletion of the group?

Re: New feature: Recover deleted Office 365 Group via PowerShell