Get-AzADUser

Lists entities from users or get entity from users by key

Warning

There are breaking changes in this cmdlet from version 6.6.0. The cmdlets in the Az PowerShell module that rely on Azure AD Graph have migrated to Microsoft Graph. This change is occurring because of the retirement announcement of Azure AD Graph. For more information, see Azure AD to Microsoft Graph migration changes in Azure PowerShell.

Syntax

Get-AzADUser
   [-Expand <String[]>]
   [-Select <String[]>]
   [-First <UInt64>]
   [-Skip <UInt64>]
   [-AppendSelected]
   [-Filter <String>]
   [-Orderby <String[]>]
   [-Search <String>]
   [-ConsistencyLevel <String>]
   [-DefaultProfile <PSObject>]
   [<CommonParameters>]
Get-AzADUser
   [-Expand <String[]>]
   [-Select <String[]>]
   [-First <UInt64>]
   [-Skip <UInt64>]
   [-AppendSelected]
   [-DefaultProfile <PSObject>]
   -Mail <String>
   [<CommonParameters>]
Get-AzADUser
   [-Expand <String[]>]
   [-Select <String[]>]
   [-First <UInt64>]
   [-Skip <UInt64>]
   [-AppendSelected]
   [-DefaultProfile <PSObject>]
   -DisplayName <String>
   [<CommonParameters>]
Get-AzADUser
   [-Expand <String[]>]
   [-Select <String[]>]
   [-First <UInt64>]
   [-Skip <UInt64>]
   [-AppendSelected]
   [-DefaultProfile <PSObject>]
   -StartsWith <String>
   [<CommonParameters>]
Get-AzADUser
   [-Expand <String[]>]
   [-Select <String[]>]
   [-AppendSelected]
   [-DefaultProfile <PSObject>]
   -ObjectId <String>
   [<CommonParameters>]
Get-AzADUser
   [-Expand <String[]>]
   [-Select <String[]>]
   [-AppendSelected]
   [-DefaultProfile <PSObject>]
   -UserPrincipalName <String>
   [<CommonParameters>]
Get-AzADUser
   [-Expand <String[]>]
   [-Select <String[]>]
   [-AppendSelected]
   [-DefaultProfile <PSObject>]
   [-SignedIn]
   [<CommonParameters>]

Description

Lists entities from users or get entity from users by key

Examples

Example 1: Get signin user

Get-AzADUser -SignedIn

Get signin user

Example 2: List users

Get-AzADUser -First 10 -Select 'City' -AppendSelected

List first 10 users and append property 'City' after default properties: 'DisplayName', 'Id', 'DeletedDateTime', 'UserPrincipalName', 'UsageLocation', 'GivenName', 'SurName', 'AccountEnabled', 'MailNickName', 'Mail'

Example 3: Get user by display name

Get-AzADUser -DisplayName $name

Get user by display name

Parameters

-AppendSelected

Append properties selected with default properties when this switch is on, only works with parameter '-Select'.

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

Indicates the requested consistency level. Documentation URL: https://developer.microsoft.com/en-us/office/blogs/microsoft-graph-advanced-queries-for-directory-objects-are-now-generally-available/

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

The credentials, account, tenant, and subscription used for communication with Azure.

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

user display name

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

Expand related entities

Type:String[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Filter

Filter items by property values

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

Gets only the first 'n' objects.

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

user mail address

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

key: id of user

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

Order items by property values

Type:String[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Search

Search items by search phrases

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

Select properties to be returned

Type:String[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-SignedIn

user mail address

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
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

user display name starts with

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

user principal name

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

Outputs

IMicrosoftGraphUser

Notes

ALIASES