SOLVED
Home

Get-AzureADMSDeletedGroup vs. 'Get-UnifiedGroup -IncludeSoftDeletedGroups'

%3CLINGO-SUB%20id%3D%22lingo-sub-176518%22%20slang%3D%22en-US%22%3EGet-AzureADMSDeletedGroup%20vs.%20'Get-UnifiedGroup%20-IncludeSoftDeletedGroups'%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-176518%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%20I%20have%20a%20question%20reqarding%20deleted%20Office%20365%20Groups.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CP%3EI%20have%20the%20two%20scenarios%3A%3CBR%20%2F%3E1st%3A%20I%20run%20%22Get-AzureADMSDeletedGroup%20%7C%20%3F%7B%24_.DeletedDateTime%20-gt%20%24DeletedGroupsStartDate%20%7D%22%20and%20get%205%20deleted%20groups.%3CBR%20%2F%3E2nd%3A%20I%20run%20%22Get-UnifiedGroup%20-IncludeSoftDeletedGroups%20%7C%20%3F%7B%24_.WhenSoftDeleted%20-gt%20%24DeletedGroupsStartDate%7D%22%20and%20get%207%20groups.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CP%3EIs%20there%20a%20difference%20between%20the%20two%20commands%3F%20I%20expect%20the%20two%20commands%20should%20show%20the%20same%20results.%20I%20don't%20understand%20why%20the%20result%20of%20the%202%20commands%20is%20different.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CP%3EBest%20regards%3CBR%20%2F%3ETobias%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-176518%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EOffice%20365%20Groups%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-191926%22%20slang%3D%22en-US%22%3ERe%3A%20Get-AzureADMSDeletedGroup%20vs.%20'Get-UnifiedGroup%20-IncludeSoftDeletedGroups'%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-191926%22%20slang%3D%22en-US%22%3E%3CP%3EYesterday%20I%20found%20the%20cause.%20There%20are%202%20issues%20preventing%20the%20EXO%20and%20AAD%20cmdlets%20returning%20the%20same%20results%20for%20deleted%20groups.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3COL%3E%3CLI%3EThe%20time%20zone%20in%20AAD%20is%20UTC%2C%20EXO%20returns%20the%20results%20in%20the%20local%20time.%20So%20I%20changed%20the%20date%20filter%20for%20deleted%20groups%20in%20AAD%20to%20UTC.%3C%2FLI%3E%3CLI%3E%26nbsp%3BThe%20main%20issue%20is%20Get-AzureADMSDeletedGroup%20does%20not%20return%20all%20deleted%20groups%20by%20default%20(and%20shows%20not%20information%20the%20results%20are%20limited).%20The%20cmdlet%20provides%20an%20additional%20parameter%20All.%3C%2FLI%3E%3C%2FOL%3E%3CP%3EGet-AzureADMSDeletedGroup%20-all%3A%24true%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CEM%3E-All%3C%2FEM%3E%3CBR%20%2F%3E%3CEM%3EIf%20true%2C%20return%20all%20group%20members.%20If%20false%2C%20return%20the%20number%20of%20objects%20specified%20by%20the%20Top%20parameter%3C%2FEM%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWithout%20the%20parameter%20Get-AzureADMSDeletedGroup%20returns%20just%20100%20results%20and%20the%20date%20filter%20was%20not%20applied%20to%20all%20deleted%20groups%20in%20AAD.%3C%2FP%3E%3CP%3EI%20did%20the%20same%20tests%2C%20one%20for%20the%20last%205%20days%20and%20one%20for%2030%20days.%20Both%20commands%20include%20now%20the%20same%20results.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-left%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F33814i51AEA2C89324C04F%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22SNAG-08-05-2018-0002.png%22%20title%3D%22SNAG-08-05-2018-0002.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-182783%22%20slang%3D%22en-US%22%3ERe%3A%20Get-AzureADMSDeletedGroup%20vs.%20'Get-UnifiedGroup%20-IncludeSoftDeletedGroups'%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-182783%22%20slang%3D%22en-US%22%3E%3CP%3EDefinitely%20sounds%20like%20a%20replication%20issue%2C%20and%20one%20that%20should%20be%20taken%20care%20of%20in%20a%20timely%20manner.%20The%20SLAs%20for%20that%20sync%20process%20should%20be%20in%20the%20range%20of%20hours%2C%20definitely%20not%20days.%20Anyway%2C%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F67%22%20target%3D%22_blank%22%3E%40Christophe%20Fiessinger%3C%2FA%3E%26nbsp%3Bmight%20be%20able%20to%20get%20right%20people%20involved.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-182398%22%20slang%3D%22en-US%22%3ERe%3A%20Get-AzureADMSDeletedGroup%20vs.%20'Get-UnifiedGroup%20-IncludeSoftDeletedGroups'%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-182398%22%20slang%3D%22en-US%22%3E%3CP%3EI%20just%20want%20to%20post%20an%20update.%20My%20case%20is%20still%20in%20progress.%20It%60s%20now%20confirmed%20the%20situation%20is%20an%20unknown%20behavior.%20In%20general%20the%202%20commands%20do%20the%20same.%20What%20we%20know%20is%20some%20deleted%20Office%20365%20Groups%20in%20Exchange%20Online%20are%20synced%20to%20the%20Azure%20AD%20recycle%20bin%20with%20a%20very%2C%20very%20long%20delay.%20I%20can%20reproduce%20a%20delay%20of%20min.%205%20days.%20For%20the%20last%2030%20days%20I%20have%20currently%2057%20deleted%20groups%20%3CSPAN%3Ethat%20have%20not%20yet%20been%20synchronized%26nbsp%3B%3C%2FSPAN%3Efrom%20EXO%20to%20AAD.%20The%20EXO%20and%20AAD%20support%20teams%20try%20to%20get%20an%20official%20time%20range%2C%20or%20maybe%20they%20have%20an%20issue%20with%20the%20sync.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20general%20all%20customers%20should%20be%20able%20to%20reproduce%20the%20situation%2C%20at%20least%20if%20you%20are%20in%20the%20region%20Europe%20West.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-176842%22%20slang%3D%22en-US%22%3ERe%3A%20Get-AzureADMSDeletedGroup%20vs.%20'Get-UnifiedGroup%20-IncludeSoftDeletedGroups'%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-176842%22%20slang%3D%22en-US%22%3EOk%2C%20thanks%20for%20the%20clarification.%20Yes%2C%20will%20open%20a%20support%20case.%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-176787%22%20slang%3D%22en-US%22%3ERe%3A%20Get-AzureADMSDeletedGroup%20vs.%20'Get-UnifiedGroup%20-IncludeSoftDeletedGroups'%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-176787%22%20slang%3D%22en-US%22%3E%3CP%3E%40Tobias%2C%20what%20I%20meant%20was%20that%20the%20Get-UnifiedGroup%20cmdlet%20run%20with%20this%20parameter%20will%20return%20both%20active%20and%20deleted%20groups%2C%20which%20you%20can%20easily%20confirm%20if%20you%20remove%20the%20filter.%20We%20have%20the%20same%20situation%20with%20the%20Get-Mailbox%20cmdlets%2C%20however%20for%20it%20we%20also%20have%20the%20-InactiveMailboxOnly%20which%20will%20filter%20out%20any%20active%20mailboxes.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%2C%20having%20seen%20the%20full%20code%20in%20your%20screenshot%2C%20the%20Groups%20returned%20definitely%20match%20the%20soft-deleted%20criteria.%20So%20you%20should%20be%20seeing%20the%20same%20between%20Get-UnifiedGroup%20and%20Get-AzureADMSDeletedGroup%20output.%20Which%20brings%20us%20to%20the%20other%20possible%20scenario%2C%20issue%20with%20the%20sync%20between%20ExODS%20and%20Azure%20AD%2C%20for%20which%20you%20should%20open%20a%20support%20case.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-176784%22%20slang%3D%22en-US%22%3ERe%3A%20Get-AzureADMSDeletedGroup%20vs.%20'Get-UnifiedGroup%20-IncludeSoftDeletedGroups'%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-176784%22%20slang%3D%22en-US%22%3E%3CP%3EI%20tested%20the%20commands%20again.%20Here%20is%20a%20screenshot%20of%20the%20commands%20and%20results.%20It's%20easy%20to%20compare.%20The%20Id%20of%26nbsp%3BGet-AzureADMSDeletedGroup%20is%20connected%20to%26nbsp%3BExternalDirectoryObjectId%20of%26nbsp%3BGet-UnifiedGroup.%20Two%20Ids%20are%20still%20missing%20in%20the%20deleted%20groups.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-left%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F31082iB2BFEFBD8F7FC4CB%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%22SNAG-28-03-2018-0001.png%22%20title%3D%22SNAG-28-03-2018-0001.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-176773%22%20slang%3D%22en-US%22%3ERe%3A%20Get-AzureADMSDeletedGroup%20vs.%20'Get-UnifiedGroup%20-IncludeSoftDeletedGroups'%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-176773%22%20slang%3D%22en-US%22%3E%3CP%3ETobias%20these%20two%20cmdlets%20should%20return%20the%20same%20results%20(assuming%20the%20data%20between%20Azure%20AD%20and%20Exchange%20has%20been%20synched)%2C%20can%20you%20consistently%20reproduce%20the%20issue%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-176672%22%20slang%3D%22en-US%22%3ERe%3A%20Get-AzureADMSDeletedGroup%20vs.%20'Get-UnifiedGroup%20-IncludeSoftDeletedGroups'%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-176672%22%20slang%3D%22en-US%22%3E%3CBLOCKQUOTE%3E%3CHR%20%2F%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F58%22%20target%3D%22_blank%22%3E%40Vasil%20Michev%3C%2FA%3E%20wrote%3A%3CBR%20%2F%3E%3CP%3EWell%2C%20the%20first%20one%20returns%20*only*%20deleted%20Groups.%20The%20second%20one%20*includes*%20deleted%20Groups%2C%20but%20will%20also%20return%20any%20*active*%20Groups%20that%20match%20the%20query.%20It's%20not%20an%20-InactiveGroupsOnly%20parameter%20%3A)%3C%2Fimg%3E%3C%2FP%3E%0A%3CHR%20%2F%3E%3C%2FBLOCKQUOTE%3E%0A%3CP%3EHm%2C%20how%20can%20be%20a%20group%20active%20if%20the%20group%20was%20deleted%3F%20%3A)%3C%2Fimg%3E%26nbsp%3BI%20checked%20the%202%20groups%20from%20the%202nd%20case%2C%20both%20groups%20are%20really%20deleted.%20Not%20available%20in%20OWA%20and%20the%20SPO%20sites%20are%20also%20changed%20to%20NoAccess.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFirst%20I%20thought%20maybe%20the%20groups%20were%20restored%20by%20the%20owner%20and%20the%20property%26nbsp%3B%3CSPAN%3EWhenSoftDeleted%20not%20replaced.%20But%20it's%20not%20the%20case.%20After%20a%20restore%20of%20a%20deleted%20test%20group%20the%20property%20is%20empty.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-176578%22%20slang%3D%22en-US%22%3ERe%3A%20Get-AzureADMSDeletedGroup%20vs.%20'Get-UnifiedGroup%20-IncludeSoftDeletedGroups'%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-176578%22%20slang%3D%22en-US%22%3E%3CP%3EWell%2C%20the%20first%20one%20returns%20*only*%20deleted%20Groups.%20The%20second%20one%20*includes*%20deleted%20Groups%2C%20but%20will%20also%20return%20any%20*active*%20Groups%20that%20match%20the%20query.%20It's%20not%20an%20-InactiveGroupsOnly%20parameter%20%3A)%3C%2Fimg%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EApart%20from%20that%2C%26nbsp%3Bone%20returns%20the%20objects%20from%20Azure%20AD%2C%20the%20other%20from%20the%20ExODS%2C%20so%20they%20are%20representing%20different%20object%20classes%2C%20with%20different%20properties%2C%20etc.%20Technically%2C%20the%20two%20should%20be%20linked%2C%20but%20there%20can%20be%20a%20slight%20disconnect%2C%20especially%20if%20you%20have%20recently%20made%20changes.%20But%20in%20general%20the%20two%20%22representations%22%20should%20be%20kept%20in%20sync.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Tobias Asböck
Contributor

Hello, I have a question reqarding deleted Office 365 Groups.

I have the two scenarios:
1st: I run "Get-AzureADMSDeletedGroup | ?{$_.DeletedDateTime -gt $DeletedGroupsStartDate }" and get 5 deleted groups.
2nd: I run "Get-UnifiedGroup -IncludeSoftDeletedGroups | ?{$_.WhenSoftDeleted -gt $DeletedGroupsStartDate}" and get 7 groups.

Is there a difference between the two commands? I expect the two commands should show the same results. I don't understand why the result of the 2 commands is different.

Best regards
Tobias

9 Replies

Well, the first one returns *only* deleted Groups. The second one *includes* deleted Groups, but will also return any *active* Groups that match the query. It's not an -InactiveGroupsOnly parameter :)

 

Apart from that, one returns the objects from Azure AD, the other from the ExODS, so they are representing different object classes, with different properties, etc. Technically, the two should be linked, but there can be a slight disconnect, especially if you have recently made changes. But in general the two "representations" should be kept in sync.


@Vasil Michev wrote:

Well, the first one returns *only* deleted Groups. The second one *includes* deleted Groups, but will also return any *active* Groups that match the query. It's not an -InactiveGroupsOnly parameter :)


Hm, how can be a group active if the group was deleted? :) I checked the 2 groups from the 2nd case, both groups are really deleted. Not available in OWA and the SPO sites are also changed to NoAccess. 

 

First I thought maybe the groups were restored by the owner and the property WhenSoftDeleted not replaced. But it's not the case. After a restore of a deleted test group the property is empty. 

 

Tobias these two cmdlets should return the same results (assuming the data between Azure AD and Exchange has been synched), can you consistently reproduce the issue?

I tested the commands again. Here is a screenshot of the commands and results. It's easy to compare. The Id of Get-AzureADMSDeletedGroup is connected to ExternalDirectoryObjectId of Get-UnifiedGroup. Two Ids are still missing in the deleted groups.

SNAG-28-03-2018-0001.png

 

 

 

 

@Tobias, what I meant was that the Get-UnifiedGroup cmdlet run with this parameter will return both active and deleted groups, which you can easily confirm if you remove the filter. We have the same situation with the Get-Mailbox cmdlets, however for it we also have the -InactiveMailboxOnly which will filter out any active mailboxes.

 

Now, having seen the full code in your screenshot, the Groups returned definitely match the soft-deleted criteria. So you should be seeing the same between Get-UnifiedGroup and Get-AzureADMSDeletedGroup output. Which brings us to the other possible scenario, issue with the sync between ExODS and Azure AD, for which you should open a support case.

Ok, thanks for the clarification. Yes, will open a support case.

I just want to post an update. My case is still in progress. It`s now confirmed the situation is an unknown behavior. In general the 2 commands do the same. What we know is some deleted Office 365 Groups in Exchange Online are synced to the Azure AD recycle bin with a very, very long delay. I can reproduce a delay of min. 5 days. For the last 30 days I have currently 57 deleted groups that have not yet been synchronized from EXO to AAD. The EXO and AAD support teams try to get an official time range, or maybe they have an issue with the sync. 

 

In general all customers should be able to reproduce the situation, at least if you are in the region Europe West.

Definitely sounds like a replication issue, and one that should be taken care of in a timely manner. The SLAs for that sync process should be in the range of hours, definitely not days. Anyway, @Christophe Fiessinger might be able to get right people involved.

Solution

Yesterday I found the cause. There are 2 issues preventing the EXO and AAD cmdlets returning the same results for deleted groups.

 

  1. The time zone in AAD is UTC, EXO returns the results in the local time. So I changed the date filter for deleted groups in AAD to UTC.
  2.  The main issue is Get-AzureADMSDeletedGroup does not return all deleted groups by default (and shows not information the results are limited). The cmdlet provides an additional parameter All.

Get-AzureADMSDeletedGroup -all:$true

 

-All
If true, return all group members. If false, return the number of objects specified by the Top parameter

 

Without the parameter Get-AzureADMSDeletedGroup returns just 100 results and the date filter was not applied to all deleted groups in AAD.

I did the same tests, one for the last 5 days and one for 30 days. Both commands include now the same results.

SNAG-08-05-2018-0002.png

 

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
50 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
32 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
15 Replies
Dev channel update to 80.0.355.1 is live
josh_bodner in Discussions on
67 Replies