Skip to main content

entra user groupmembership list

Retrieves all groups where the user is a member of

Usage

m365 entra user groupmembership list [options]

Options

-i, --userId [userId]

The ID of the user to retrieve information for. Use either userId, userName or userEmail, but not multiple.

-n, --userName [userName]

The name of the user to retrieve information for. Use either userId, userName or userEmail, but not multiple.

-e, --userEmail [userEmail]

The email of the user to retrieve information for. Use either userId, userName or userEmail, but not multiple.

--securityEnabledOnly [securityEnabledOnly]

Specifies that only security-enabled groups that the user is a member of should be returned

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

Examples

Retrieves groups that the user is a member of

m365 entra user groupmembership list --userId '1caf7dcd-7e83-4c3a-94f7-932a1299c844'

Retrieves only security groups that the user is a member of

m365 entra user groupmembership list --userName 'john.doe@contoso.com' --securityEnabledOnly

Retrieves groups where the currently logged user is a member of

m365 entra user groupmembership list --userId '@meId'

Retrieves groups where the currently logged user is a member of

m365 entra user groupmembership list --userName '@meUserName'

Response

[
{
"groupId": "01b62bc5-9701-4f93-9587-9d1ea58a086d"
},
{
"groupId": "619701a2-4bdc-494a-a9dd-9d3aeebcafd9"
},
{
"groupId": "ec98d904-ac8c-49f0-99e1-c9c0e1a1e453"
}
]
CTRL + M