Skip to content

New command: List members of administrative unit #5640

@MartinM85

Description

@MartinM85

Usage

m365 aad administrativeunit member list

Description

Retrieves members (users, groups, or devices) of an administrative unit

Options

Option Description
-i, --administrativeUnitId [administrativeUnitId] The id of the administrative unit. Specify either administrativeUnitId or administrativeUnitName.
-n, --administrativeUnitName [administrativeUnitName] The name of the administrative unit. Specify either administrativeUnitId or administrativeUnitName.
-t, --type [type] When specified, the command returns only objects of specified type. Allowed values are user, group and device.
-p, --properties [properties] Comma-separated list of properties to retrieve.
-f, --filter [filter] OData filter to use to query the list of members with. Applied only when type is specified.

Examples

List members of an administrative unit specified by its id

m365 aad administrativeunit member list --administrativeUnitId 03c4c9dc-6f0c-4c4f-a4e6-0c9ed80f54c7

List members of an administrative unit specified by its id. For each one return the id and the displayName

m365 aad administrativeunit member list --administrativeUnitId 03c4c9dc-6f0c-4c4f-a4e6-0c9ed80f54c7 --properties 'id,displayName'

List members of an administrative unit specified by its name

m365 aad administrativeunit member list --administrativeUnitName 'Marketing Division'

List users of an administrative unit specified by its id

m365 aad administrativeunit member list --administrativeUnitId 03c4c9dc-6f0c-4c4f-a4e6-0c9ed80f54c7 --type user

List users of an administrative unit specified by its id that are guest users

m365 aad administrativeunit member list --administrativeUnitId 03c4c9dc-6f0c-4c4f-a4e6-0c9ed80f54c7 --type user --filter "userType eq 'Guest'"

List groups of an administrative unit specified by its id

m365 aad administrativeunit member list --administrativeUnitId 03c4c9dc-6f0c-4c4f-a4e6-0c9ed80f54c7 --type group

List groups of an administrative unit specified by its id and include owners names

m365 aad administrativeunit member list --administrativeUnitId 03c4c9dc-6f0c-4c4f-a4e6-0c9ed80f54c7 --type group --properties 'id,displayName,owners/displayName'

List devices of an administrative unit specified by its id

m365 aad administrativeunit member list --administrativeUnitId 03c4c9dc-6f0c-4c4f-a4e6-0c9ed80f54c7 --type device

List devices with linux operating system of an administrative unit specified by its id

m365 aad administrativeunit member list --administrativeUnitId 03c4c9dc-6f0c-4c4f-a4e6-0c9ed80f54c7 --type device --filter "operatingSystem eq 'linux'"

Default properties

  • id
  • displayName

Additional Info

https://learn.microsoft.com/en-us/graph/api/administrativeunit-list-members?view=graph-rest-1.0&tabs=http

The endpoint supports OData cast, you can cast to get either only users, groups or devices. To support casting, set an option type with one of possible values user, group and device.

For large administrative units, the casting can be useful and expected by the end-users.

Response output formatting

To know which item in the response array is what type, we'll add our own property based on the odata metadata.

"@odata.type": "#microsoft.graph.device" becomes "type": "device".


I will work on this

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions