How to list empty Azure AD groups

Stefan Diedericks 85 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.
13,547 questions
No comments
{count} votes

Accepted answer
  1. Vasil Michev 66,601 Reputation points 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)}

0 additional answers

Sort by: Most helpful