Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Thursday, August 30, 2018 8:22 AM
How is it possible to compare 2 azure ad groups. The one group is containing 3640 and the other 3661 users - so I would like to find the difference
I can find a lot of examples of powershell for comparing ad groups - but not with azure ad groups
All replies (3)
Thursday, August 30, 2018 8:28 AM
help Get-AzureRmADGroupMember -full
It's the same as AD.
\(ツ)_/
Thursday, August 30, 2018 9:10 AM
Hi,
Thanks for your question.
I agree with jrv sir.
If you want to compare 2 azure ad groups member's specific property, you can use the command below.
diff (Get-AzureRmADGroupMember "Group 1") (Get-AzureRmADGroupMember "Group 2") -Property 'propertyname' -IncludeEqual
Best Regards,
Lee
Just do it.
Thursday, August 30, 2018 10:10 AM
A slightly different example using the AzureAD module instead of Azure Resource Manager.
$membersOfGroup1 = Get-AzureADGroup -SearchString "GroupName1" |
Get-AzureADGroupMember |
Select-Object -ExpandProperty DisplayName
$membersOfGroup2 = Get-AzureADGroup -SearchString "GroupName2" |
Get-AzureADGroupMember |
Select-Object -ExpandProperty DisplayName
Compare-Object -ReferenceObject $membersOfGroup1 -DifferenceObject $membersOfGroup2