Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds "aad administrativeunit member add" command. Closes #5615 #5651

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import Global from '/docs/cmd/_global.mdx';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

# aad administrativeunit member add

Add a member (user, group, or device) to an administrative unit

## Usage

```sh
m365 aad administrativeunit member add [options]
```

## Options

```md definition-list
`-i, --administrativeUnitId [administrativeUnitId]`
: The id of the administrative unit. Specify either `administrativeUnitId` or `administrativeUnitName` but not both.

`-n, --administrativeUnitName [administrativeUnitName]`
: The name of the administrative unit. Specify either `administrativeUnitId` or `administrativeUnitName` but not both.

`--userId [userId]`
: The id of the user to be added. Specify `userId`, `userName`, `groupId`, `groupName`, `deviceId` or `deviceName`.

`--userName [userName]`
: The user principal name (UPN) of the user to be added. Specify `userId`, `userName`, `groupId`, `groupName`, `deviceId` or `deviceName`.

`--groupId [groupId]`
: The id of the group to be added. Specify `userId`, `userName`, `groupId`, `groupName`, `deviceId` or `deviceName`.

`--groupName [groupName]`
: The name of the group to be added. Specify `userId`, `userName`, `groupId`, `groupName`, `deviceId` or `deviceName`.

`--deviceId [deviceId]`
: The id of the device to be added. Specify `userId`, `userName`, `groupId`, `groupName`, `deviceId` or `deviceName`.

`--deviceName [deviceName]`
: The name of the device to be added. Specify `userId`, `userName`, `groupId`, `groupName`, `deviceId` or `deviceName`.
```

<Global />

## Remarks

:::info

To use this command you must be either **Global Administrator** or **Privileged Role Administrator**.

:::

## Examples

Add a single user specified by id to an administrative unit specified by id

```sh
m365 aad administrativeunit member add --administrativeUnitId 03c4c9dc-6f0c-4c4f-a4e6-0c9ed80f54c7 --userId 1caf7dcd-7e83-4c3a-94f7-932a1299c844
```

Add a single user specified by user principal name to an administrative unit specified by name

```sh
m365 aad administrativeunit member add --administrativeUnitName 'Marketing Division' --userName john.doe@contoso.com
```

Add a single group specified by id to an administrative unit specified by id

```sh
m365 aad administrativeunit member add --administrativeUnitId 03c4c9dc-6f0c-4c4f-a4e6-0c9ed80f54c7 --groupId b2307a39-e878-458b-bc90-03bc578531d6
```

Add a single group specified by name to an administrative unit specified by name

```sh
m365 aad administrativeunit member add --administrativeUnitName 'Marketing Division' --groupName 'Marketing Group'
```

Add a single device specified by id to an administrative unit specified by id

```sh
m365 aad administrativeunit member add --administrativeUnitId 03c4c9dc-6f0c-4c4f-a4e6-0c9ed80f54c7 --deviceId 810c84a8-4a9e-49e6-bf7d-12d183f40d01
```

Add a single device specified by name to an administrative unit specified by name

```sh
m365 aad administrativeunit member add --administrativeUnitName 'Marketing Division' --deviceName 'JohnDoe-PC'
```

## More information

- Administrative units: https://learn.microsoft.com/entra/identity/role-based-access-control/administrative-units
5 changes: 5 additions & 0 deletions docs/src/config/sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ const sidebars: SidebarsConfig = {
label: 'administrativeunit remove',
id: 'cmd/aad/administrativeunit/administrativeunit-remove'
},
{
type: 'doc',
label: 'administrativeunit member add',
id: 'cmd/aad/administrativeunit/administrativeunit-member-add'
},
{
type: 'doc',
label: 'administrativeunit member list',
Expand Down
1 change: 1 addition & 0 deletions src/m365/aad/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export default {
ADMINISTRATIVEUNIT_GET: `${prefix} administrativeunit get`,
ADMINISTRATIVEUNIT_LIST: `${prefix} administrativeunit list`,
ADMINISTRATIVEUNIT_REMOVE: `${prefix} administrativeunit remove`,
ADMINISTRATIVEUNIT_MEMBER_ADD: `${prefix} administrativeunit member add`,
ADMINISTRATIVEUNIT_MEMBER_LIST: `${prefix} administrativeunit member list`,
APP_ADD: `${prefix} app add`,
APP_GET: `${prefix} app get`,
Expand Down
Loading