Redigera

Dela via


Get-AzADUser

Lists entities from users or get entity from users by key

Syntax

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>]
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

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'.

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

-Count

Include count of items

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

Type:String
Position:Named
Default value:None
Required:False
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
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DisplayName

user display name

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

-Expand

Expand related entities

Type:String[]
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters: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

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

-First

Gets only the first 'n' objects.

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

-Mail

user mail address

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

-ObjectId

key: id of user

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

-Orderby

Order items by property values

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

Search items by search phrases

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

-Select

Select properties to be returned

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

-SignedIn

user mail address

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

-StartsWith

user display name starts with

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

-UserPrincipalName

user principal name

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

Outputs

IMicrosoftGraphUser

Notes

ALIASES