Get-AzADUser
Lists entities from users or get entity from users by key
Syntax
List (Default)
Get-AzADUser
[-Count]
[-Expand <String[]>]
[-Select <String[]>]
[-First <UInt64>]
[-Skip <UInt64>]
[-AppendSelected]
[-Filter <String>]
[-Orderby <String[]>]
[-Search <String>]
[-ConsistencyLevel <String>]
[-DefaultProfile <PSObject>]
[-CountVariable <String>]
[<CommonParameters>]
MailParameterSet
Get-AzADUser
-Mail <String>
[-Expand <String[]>]
[-Select <String[]>]
[-First <UInt64>]
[-Skip <UInt64>]
[-AppendSelected]
[-DefaultProfile <PSObject>]
[<CommonParameters>]
DisplayNameParameterSet
Get-AzADUser
-DisplayName <String>
[-Expand <String[]>]
[-Select <String[]>]
[-First <UInt64>]
[-Skip <UInt64>]
[-AppendSelected]
[-DefaultProfile <PSObject>]
[<CommonParameters>]
StartsWithParameterSet
Get-AzADUser
-StartsWith <String>
[-Expand <String[]>]
[-Select <String[]>]
[-First <UInt64>]
[-Skip <UInt64>]
[-AppendSelected]
[-DefaultProfile <PSObject>]
[<CommonParameters>]
ObjectIdParameterSet
Get-AzADUser
-ObjectId <String>
[-Expand <String[]>]
[-Select <String[]>]
[-AppendSelected]
[-DefaultProfile <PSObject>]
[<CommonParameters>]
UPNParameterSet
Get-AzADUser
-UserPrincipalName <String>
[-Expand <String[]>]
[-Select <String[]>]
[-AppendSelected]
[-DefaultProfile <PSObject>]
[<CommonParameters>]
SignedInUser
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
Example 4: Get user with filter
Get-AzADUser -Filter "startsWith(DisplayName,'some-name')"
Get user with filter
Example 5: Assign OdataCount to a variable
Get-AzADUser -First 10 -ConsistencyLevel eventual -Count -CountVariable 'result'
$result
Assign OdataCount to a variable
Parameters
-AppendSelected
Append properties selected with default properties when this switch is on, only works with parameter '-Select'.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: 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/
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
List
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Count
Include count of items
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
List
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-CountVariable
Specifies a count of the total number of items in a collection.
By default, this variable will be set in the global scope.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
List
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.
Parameter properties
Type: PSObject
Default value: None
Supports wildcards: False
DontShow: False
Aliases: AzContext, AzureRmContext, AzureCredential
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-DisplayName
user display name
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
DisplayNameParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Expand
Expand related entities
Parameter properties
Type: String [ ]
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Filter
Filter items by property values, for more detail about filter query please see: https://learn.microsoft.com/en-us/graph/filter-query-parameter
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
List
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-First
Gets only the first 'n' objects.
Parameter properties
Type: UInt64
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
List
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
MailParameterSet
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
DisplayNameParameterSet
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
StartsWithParameterSet
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Mail
user mail address
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
MailParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ObjectId
key: id of user
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
ObjectIdParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Orderby
Order items by property values
Parameter properties
Type: String [ ]
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
List
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Search
Search items by search phrases
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
List
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Select
Select properties to be returned
Parameter properties
Type: String [ ]
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-SignedIn
user mail address
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
SignedInUser
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Skip
Ignores the first 'n' objects and then gets the remaining objects.
Parameter properties
Type: UInt64
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
List
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
MailParameterSet
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
DisplayNameParameterSet
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
StartsWithParameterSet
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-StartsWith
user display name starts with
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Aliases: SearchString
Parameter sets
StartsWithParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-UserPrincipalName
user principal name
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Aliases: UPN
Parameter sets
UPNParameterSet
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters .
Outputs