entra user list
Lists users matching specified criteria
Usage
m365 entra user list [options]
Alias
m365 aad user list [options]
Options
--type [type]
Filter the results to only users of a given type:
Member
orGuest
. By default, all users are listed.-p, --properties [properties]
Comma-separated list of properties to retrieve
-h, --help [help]
Output usage information. Optionally, specify which section of command's help you want to see. Allowed values are
options
,examples
,remarks
,response
,full
. Default isoptions
.--query [query]
JMESPath query string. See http://jmespath.org/ for more information and examples.
-o, --output [output]
Output type.
json
,text
,csv
,md
,none
. Defaultjson
.--verbose
Runs command with verbose logging.
--debug
Runs command with debug logging.
Remarks
Using the --properties
option, you can specify a comma-separated list of user properties to retrieve from the Microsoft Graph. If you don't specify any properties, the command will retrieve user's display name, account name, id, and mail.
When the properties
option includes values with a /
, for example: manager/displayName
, an additional $expand
query parameter will be included on manager
.
To filter the list of users, include additional options that match the user property that you want to filter with. For example --displayName Patt
will return all users whose displayName
starts with Patt
. Multiple filters will be combined using the and
operator.
Certain properties cannot be returned within a user collection. The following properties are only supported when retrieving an single user using: aboutMe
, birthday
, hireDate
, interests
, mySite
, pastProjects
, preferredName
, responsibilities
, schools
, skills
, mailboxSettings
.
Examples
List all users in the tenant.
m365 entra user list
List all guest users in the tenant.
m365 entra user list --type Guest
List all users in the tenant. For each one return the display name and e-mail address.
m365 entra user list --properties "displayName,mail"
Show users whose display name starts with Patt.
m365 entra user list --displayName Patt
Show all account managers whose display name starts with Patt.
m365 entra user list --displayName Patt --jobTitle 'Account manager'
List users from the tenant. For each one return the display name, e-mail address, and manager information.
m365 entra user list --properties "displayName,mail,manager/*"
Response
- JSON
- Text
- CSV
- Markdown
[
{
"id": "1f5595b2-aa07-445d-9801-a45ea18160b2",
"displayName": "John Doe",
"mail": "John@contoso.onmicrosoft.com",
"userPrincipalName": "John@contoso.onmicrosoft.com"
}
]
id displayName mail userPrincipalName
------------------------------------ ------------------ ----------------------------------- ------------------------------------------
1f5595b2-aa07-445d-9801-a45ea18160b2 John Doe John@contoso.onmicrosoft.com John@contoso.onmicrosoft.com
id,displayName,mail,userPrincipalName
1f5595b2-aa07-445d-9801-a45ea18160b2,John Doe,John@contoso.onmicrosoft.com,John@contoso.onmicrosoft.com
# entra user list
Date: 2023-06-02
## John Doe (1f5595b2-aa07-445d-9801-a45ea18160b2)
Property | Value
---------|-------
id | 1f5595b2-aa07-445d-9801-a45ea18160b2
displayName | John Doe
mail | John@contoso.onmicrosoft.com
userPrincipalName | John@contoso.onmicrosoft.com
More information
- Microsoft Graph User properties: https://learn.microsoft.com/graph/api/resources/user?view=graph-rest-1.0#properties