How to list empty Azure AD groups

Stefan Diedericks 40 Reputation points
2023-01-17T07:49:06.32+00:00

I’m having trouble pulling a list of empty Azure Active Directory groups, as there are over 500 groups I need a quicker way to pull a list.

thank you in advance

Azure Active Directory
Azure Active Directory
An Azure enterprise identity service that provides single sign-on and multi-factor authentication.
12,753 questions
No comments
{count} votes

Accepted answer
  1. Vasil Michev 62,156 Reputation points Microsoft MVP
    2023-01-17T08:02:56.43+00:00

    Using PowerShell or? Try something like this:

     

    Get-MsolGroup -GroupType Security | ? {(Get-MsolGroupMember -GroupObjectId $_.ObjectId).count -eq 0 }

    A more "modern" approach using the Graph SDK for PowerShell:

    Get-MgGroup | ? {!(Get-MgGroupMember -GroupId $_.Id)}

    No comments

0 additional answers

Sort by: Most helpful