Life's random bits By b1thunt3r (aka Ishan Jain)…
Entra ID (Azure AD) Group Members Count

Entra ID (Azure AD) Group Members Count

Ishan jain
I just want to find out how many friends I should have!

List all the groups in Entra ID with member count.

  • Azure CLI

    az ad group list --query "[].{displayName:displayName, objectId:id}" -o tsv |   awk {'split($0,a,"\\t"); {print a[1] a[2];system("az ad group member list   --query \"length(@)\" --group " a[2])}}'
    
  • Azure PowerShell

    Get-AzureADGroup -All $true | ForEach-Object {
        [PsCustomObject]@{
            Group       = $_.DisplayName
            MemberCount = @(Get-AzureADGroupMember -ObjectId $_.ObjectId -All   $true).Count
        }
    } | Format-Table -AutoSize
    

Req: PowerShell AzureAD Module