Skip to main content

entra user get

Gets information about the specified user

Usage

m365 entra user get [options]

Options

-i, --id [id]

The ID of the user to retrieve information for. Use either id, userName or email, but not all.

-n, --userName [userName]

The name of the user to retrieve information for. Use either id, userName or email, but not all.

--email [email]

The email of the user to retrieve information for. Use either id, userName or email, but not all.

-p, --properties [properties]

Comma-separated list of properties to retrieve.

--withManager

Retrieve the direct manager of the user.

-h, --help [help]

Output usage information. Optionally, specify which section of command's help you want to see. Allowed values are options, examples, remarks, permissions, response, full. Default is options.

--query [query]

JMESPath query string. See http://jmespath.org/ for more information and examples.

-o, --output [output]

Output type. json, text, csv, md, none. Default json.

--verbose

Runs command with verbose logging.

--debug

Runs command with debug logging.

Remarks

If the user with the specified id, user name, or email doesn't exist, you will get a Resource 'xyz' does not exist or one of its queried reference-property objects are not present. error.

Permissions

ResourcePermissions
Microsoft GraphUser.Read.All

Examples

Get information about the user by id.

m365 entra user get --id 1caf7dcd-7e83-4c3a-94f7-932a1299c844

Get information about the user by user name.

m365 entra user get --userName AarifS@contoso.onmicrosoft.com

Get information about the user by email.

m365 entra user get --email AarifS@contoso.onmicrosoft.com

For the user with id 1caf7dcd-7e83-4c3a-94f7-932a1299c844 retrieve the user name, e-mail address and full name.

m365 entra user get --id 1caf7dcd-7e83-4c3a-94f7-932a1299c844 --properties "userPrincipalName,mail,displayName"

Get information about the currently logged user using the Id token.

m365 entra user get --id "@meId"

Get information about the currently logged in user using the UserName token.

m365 entra user get --userName "@meUserName"

Get information about a user with the manager's details.

m365 entra user get --userName AarifS@contoso.onmicrosoft.com --withManager

Response

Standard response

{
"businessPhones": ["+32499-99-99-99"],
"displayName": "John Doe",
"givenName": "John",
"jobTitle": "Sales Manager",
"mail": "john.doe@contoso.com",
"mobilePhone": "+32499-99-99-99",
"officeLocation": "Vosselaar",
"preferredLanguage": "nl-BE",
"surname": "Doe",
"userPrincipalName": "john.doe@contoso.com",
"id": "990e2425-f595-43bc-85ed-b89a44093793"
}

withManager response

When we make use of the option withManager the response will differ.

{
"businessPhones": ["+32499-99-99-99"],
"displayName": "John Doe",
"givenName": "John",
"jobTitle": "Sales Manager",
"mail": "john.doe@contoso.com",
"mobilePhone": "+32499-99-99-99",
"officeLocation": "Vosselaar",
"preferredLanguage": "nl-BE",
"surname": "Doe",
"userPrincipalName": "john.doe@contoso.com",
"id": "990e2425-f595-43bc-85ed-b89a44093793",
"manager": {
"displayName": "Jane Doe",
"userPrincipalName": "jane.doe@contoso.com",
"id": "eb77fbcf-6fe8-458b-985d-1747284793bc",
"mail": "jane.doe@contoso.com"
}
}

More information