Get a Count of Azure AD Active Directory Users

Share This:

Azure Active Directory

If you’re using Azure Active Directory, there might be a time where you’ll need to get a count of all the user accounts in your environment. You can use the Powershell commands below to get a listing and get counts for your Directory Synced and Cloud-Only Azure AD users.

  • Open Powershell
  • Run Connect-AzureAD and sign into your Azure account
  • Run this command to get the count of Azure AD users:

    (Get-AzureADUser -all $true | Where {$_.DirSyncEnabled -eq $true}).Count

  • If you would like a list of all Azure users, you can use this command:

    Get-AzureADUser -all $true | Where {$_.DirSyncEnabled -eq $true}

  • If you need a count of cloud-only Azure AD user accounts, use this command:

    (Get-AzureADUser -all $true | Where {$_.DirSyncEnabled -eq $null}).Count

  • To get a list of all cloud-only Azure AD users, use this command:

    Get-AzureADUser -all $true | Where {$_.DirSyncEnabled -eq $null}

If you need to get counts for Azure AD Groups, you can use the Get-AzureADGroup command above instead of Get-AzureADUser.


Share This:

 

Leave a Comment