Skip to content

Commit

Permalink
Extends 'aad m365group user list' command with extra options and depr…
Browse files Browse the repository at this point in the history
…ecation. Closes #5557
  • Loading branch information
nanddeepn authored and Waldek Mastykarz committed Jan 3, 2024
1 parent 1e22f83 commit 5513612
Show file tree
Hide file tree
Showing 3 changed files with 353 additions and 84 deletions.
56 changes: 41 additions & 15 deletions docs/docs/cmd/aad/m365group/m365group-user-list.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,52 @@ m365 aad m365group user list [options]
## Options

```md definition-list
`-i, --groupId <groupId>`
: The ID of the Microsoft 365 group for which to list users
`-i, --groupId [groupId]`
: The ID of the Microsoft 365 group. Specify `groupId` or `groupDisplayName` but not both.

`-n, --groupDisplayName [groupDisplayName]`
: The display name of the Microsoft 365 group. Specify `groupId` or `groupDisplayName` but not both.

`-r, --role [role]`
: Filter the results to only users with the given role: `Owner`, `Member`, `Guest`
: Filter the results to only users with the given role. Allowed values: `Owner`, `Member`, or (Deprecated) `Guest`.

`-p, --properties [properties]`
: Comma-separated list of properties to retrieve.

`-f, --filter [filter]`
: OData filter to use to query the list of users with.
```

<Global />

## Remarks

When the `properties` option includes values with a `/`, for example: `manager/displayName`, an additional `$expand` query parameter will be included on `manager`.

## Examples

List all users and their role in the specified Microsoft 365 group
List all users and their role from Microsoft 365 group specified by ID.

```sh
m365 aad m365group user list --groupId '00000000-0000-0000-0000-000000000000'
m365 aad m365group user list --groupId 00000000-0000-0000-0000-000000000000
```

List all owners from Microsoft 365 group specified by display name.

```
m365 aad m365group user list --groupDisplayName Developers --role Owner
```

List all owners and their role in the specified Microsoft 365 group
List specific properties for all group users from a group specified by ID.

```sh
m365 aad m365group user list --groupId '00000000-0000-0000-0000-000000000000' --role Owner
m365 aad m365group user list --groupId 03cba9da-3974-46c1-afaf-79caa2e45bbe --properties "id,jobTitle,companyName,accountEnabled"
```

List all guests and their role in the specified Microsoft 365 group
List all group members that are guest users.

```sh
m365 aad m365group user list --groupId '00000000-0000-0000-0000-000000000000' --role Guest
m365 aad m365group user list --groupDisplayName Developers --filter "userType eq 'Guest'"
```

## Response
Expand All @@ -55,7 +74,12 @@ m365 aad m365group user list --groupId '00000000-0000-0000-0000-000000000000' --
"id": "da52218e-4822-4ac6-b41d-255e2059655e",
"displayName": "Adele Vance",
"userPrincipalName": "[email protected]",
"userType": "Member"
"givenName": "Adele",
"surname": "Vance",
"roles": [
"Owner",
"Member"
]
}
]
```
Expand All @@ -64,17 +88,17 @@ m365 aad m365group user list --groupId '00000000-0000-0000-0000-000000000000' --
<TabItem value="Text">

```text
id displayName userPrincipalName userType
------------------------------------ -------------------- ------------------------------------ --------
da52218e-4822-4ac6-b41d-255e2059655e Adele Vance [email protected] Member
id displayName userPrincipalName userType roles
------------------------------------ -------------------- ------------------------------------ -------- --------
da52218e-4822-4ac6-b41d-255e2059655e Adele Vance [email protected] Owner,Member Owner,Member
```

</TabItem>
<TabItem value="CSV">

```csv
id,displayName,userPrincipalName,userType
da52218e-4822-4ac6-b41d-255e2059655e,Adele Vance,[email protected],Member
id,displayName,userPrincipalName,givenName,surname,userType
da52218e-4822-4ac6-b41d-255e2059655e,Adele Vance,[email protected],Adele,Vance,Member
```

</TabItem>
Expand All @@ -91,6 +115,8 @@ m365 aad m365group user list --groupId '00000000-0000-0000-0000-000000000000' --
---------|-------
id | da52218e-4822-4ac6-b41d-255e2059655e
displayName | Adele Vance
givenName | Adele
surname | Vance
userPrincipalName | [email protected]
userType | Member
```
Expand Down
Loading

0 comments on commit 5513612

Please sign in to comment.