pnp / cli-microsoft365

Manage Microsoft 365 and SharePoint Framework projects on any platform
https://aka.ms/cli-m365
MIT License
882 stars 312 forks source link

New command: Remove member from administrative unit #5734

Closed MartinM85 closed 4 months ago

MartinM85 commented 6 months ago

Usage

m365 entra administrativeunit member remove

Description

Remove a specific member (user, group, or device) from an administrative unit

Options

Option Description
-i, --id [id] The id of the member to be removed. Specify either id, userId, userName, groupId, groupName, deviceId or deviceName.
--userId [userId] The id of the user to be removed. Specify either id, userId, userName, groupId, groupName, deviceId or deviceName.
--userName [userName] The user principal name (UPN) of the user to be removed. Specify either id, userId, userName, groupId, groupName, deviceId or deviceName.
--groupId [groupId] The id of the group to be removed. Specify either id, userId, userName, groupId, groupName, deviceId or deviceName.
--groupName [groupName] The name of the group to be removed. Specify either id, userId, userName, groupId, groupName, deviceId or deviceName.
--deviceId [deviceId] The id of the device to be removed. Specify either id, userId, userName, groupId, groupName, deviceId or deviceName.
--deviceName [deviceName] The name of the device to be removed. Specify either id, userId, userName, groupId, groupName, deviceId or deviceName.
--administrativeUnitId [administrativeUnitId] The id of the administrative unit. Specify either administrativeUnitId or administrativeUnitName.
--administrativeUnitName [administrativeUnitName] The name of the administrative unit. Specify either administrativeUnitId or administrativeUnitName.
-f, --force Don't prompt for confirmation.

Examples

Remove a member specified by id from an administrative unit specified by id

m365 entra administrativeunit member remove --id 64131a70-beb9-4ccb-b590-4401e58446ec --administrativeUnitId 03c4c9dc-6f0c-4c4f-a4e6-0c9ed80f54c7

Remove a user specified by id from an administrative unit specified by id

m365 entra administrativeunit member remove --userId 64131a70-beb9-4ccb-b590-4401e58446ec --administrativeUnitId 03c4c9dc-6f0c-4c4f-a4e6-0c9ed80f54c7

Remove a group specified by id from an administrative unit specified by id

m365 entra administrativeunit member remove --groupId b2307a39-e878-458b-bc90-03bc578531d6 --administrativeUnitId 03c4c9dc-6f0c-4c4f-a4e6-0c9ed80f54c7

Remove a device specified by id from an administrative unit specified by id

m365 entra administrativeunit member remove --deviceId 810c84a8-4a9e-49e6-bf7d-12d183f40d01 --administrativeUnitId 03c4c9dc-6f0c-4c4f-a4e6-0c9ed80f54c7

Remove a user specified by UPN from an administrative unit specified by name

m365 entra administrativeunit member remove --userName john.doe@contoso.com --administrativeUnitName 'Marketing Division'

Remove a group specified by name from an administrative unit specified by id

m365 entra administrativeunit member remove --groupName 'Marketing Group' --administrativeUnitId 03c4c9dc-6f0c-4c4f-a4e6-0c9ed80f54c7

Remove a device specified by name from an administrative unit specified by name

m365 entra administrativeunit member remove --deviceName 'JohnDoe-PC' --administrativeUnitName 'Marketing Division'

Default properties

No response

Additional Info

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

I will work on this issue.

milanholemans commented 6 months ago

Hi @MartinM85 thank you for the spec!

Few considerations:

MartinM85 commented 6 months ago

@milanholemans Do you suggest to have id option together with userId, groupId, and deviceId options or only userId, groupId, and deviceId options and remove id option?

It seems to me fine to have only "generic" id option for this command.

milanholemans commented 6 months ago

Hi @MartinM85, the id option is definitely useful, I'm just suggesting to add these other options as well. Since we have these options at the aad administrativeunit member add, the remove command should work similarly (with addition to id and force).

MartinM85 commented 6 months ago

@milanholemans Spec updated.

milanholemans commented 6 months ago

Great, could you also replace all aad occurrences with entra?

MartinM85 commented 6 months ago

@milanholemans Replaced

milanholemans commented 6 months ago

Great! Looks good now! As mentioned before, I think you better wait until #5663 is finished to avoid unneeded merge conflicts.

MartinM85 commented 6 months ago

OK, there is already opened PR for #5663. I will postpone the delivery.

milanholemans commented 6 months ago

OK, there is already opened PR for #5663. I will postpone the delivery.

Yes indeed, we marked it as highest priority to unblock other issues.