Get-AzADUser

Filters active directory users.

Warning

There are upcoming breaking changes in this cmdlet. These changes are currently in preview with Az.Resources version 5.0.0-preview. They will become generally available with our next major release of the Az PowerShell module, version 7.x in December of 2021. For more information, see Azure AD to Microsoft Graph migration changes in Azure PowerShell.

Note

This is the previous version of our documentation. Please consult the most recent version for up-to-date information.

Syntax

Get-AzADUser
   [-UserPrincipalName <String>]
   [-DefaultProfile <IAzureContextContainer>]
   [-IncludeTotalCount]
   [-Skip <UInt64>]
   [-First <UInt64>]
   [<CommonParameters>]
Get-AzADUser
   -StartsWith <String>
   [-DefaultProfile <IAzureContextContainer>]
   [-IncludeTotalCount]
   [-Skip <UInt64>]
   [-First <UInt64>]
   [<CommonParameters>]
Get-AzADUser
   -DisplayName <String>
   [-DefaultProfile <IAzureContextContainer>]
   [-IncludeTotalCount]
   [-Skip <UInt64>]
   [-First <UInt64>]
   [<CommonParameters>]
Get-AzADUser
   -ObjectId <String>
   [-DefaultProfile <IAzureContextContainer>]
   [-IncludeTotalCount]
   [-Skip <UInt64>]
   [-First <UInt64>]
   [<CommonParameters>]
Get-AzADUser
   -UserPrincipalName <String>
   [-DefaultProfile <IAzureContextContainer>]
   [-IncludeTotalCount]
   [-Skip <UInt64>]
   [-First <UInt64>]
   [<CommonParameters>]
Get-AzADUser
   -Mail <String>
   [-DefaultProfile <IAzureContextContainer>]
   [-IncludeTotalCount]
   [-Skip <UInt64>]
   [-First <UInt64>]
   [<CommonParameters>]

Description

Filters active directory users.

Examples

Example 1: List all users

PS C:\> Get-AzADUser

Lists all AD users in a tenant.

Example 2: List all users using paging

PS C:\> Get-AzADUser -First 100

Lists the first 100 AD users in a tenant.

Example 3: Get AD user by user principal name

PS C:\> Get-AzADUser -UserPrincipalName foo@domain.com

Gets the AD user with user principal name "foo@domain.com".

Example 4: List by search string

PS C:\> Get-AzADUser -SearchString Joe

Lists all AD users whose display name starts with "Joe".

Parameters

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with azure

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DisplayName

The display name of the user.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-First

The maximum number of objects to return.

Type:UInt64
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-IncludeTotalCount

Reports the number of objects in the data set. Currently, this parameter does nothing.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Mail

The user mail.

Type:String
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-ObjectId

Object id of the user.

Type:String
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-Skip

Ignores the first N objects and then gets the remaining objects.

Type:UInt64
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-StartsWith

Used to find users that begin with the provided string.

Type:String
Aliases:SearchString
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-UserPrincipalName

UPN of the user.

Type:String
Aliases:UPN
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False

Inputs

String

Outputs

PSADUser