pnp / cli-microsoft365

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

Change functionality of `entra m365group set` when specifying users #6061

Open milanholemans opened 3 months ago

milanholemans commented 3 months ago

Looking at the current implementation of entra m365group set we have 2 options called owners and members. In the docs, we state that these options only add users as owner/member.

When updating group's owners and members, the command will add newly specified users to the previously set owners and members. The previously set users will not be replaced.

For this functionality, we have the command entra m365group user add. I suggest that we modify the functionality so that all existing owners/members are removed from the group, and the specified users are added.

Currently, it's only possible to specify users by UPN. Let's extend it so you can specify users by ID as well.

Options to add

Option Description
--ownerIds [ownerIds] Comma-separated list of IDs of Microsoft Entra ID users that will be group owners.
--ownerUserNames [ownerUserNames] Comma-separated list of UPNs of Microsoft Entra ID users that will be group owners.
--memberIds [memberIds] Comma-separated list of IDs of Microsoft Entra ID users that will be group members.
--memberUserNames [memberUserNames] Comma-separated list of UPNs of Microsoft Entra ID users that will be group members.

Removing existing options

This also means that we have to remove options that currently exist:

Adam-it commented 2 months ago

Since we have v8 branch we may now start working on it! Let's get this ๐Ÿšข and Let's put CLI to the ๐Ÿš€๐ŸŒ™

nanddeepn commented 1 month ago

Can I work on it?

nanddeepn commented 1 month ago

Hi, Should the PR be targeted to v9 or main branch?

Adam-it commented 1 month ago

Hi, Should the PR be targeted to v9 or main branch?

Since we consider this a breaking change it should be targeted to v9

nanddeepn commented 1 month ago

Hi @milanholemans Is there any direct way to remove the existing group owners and members? Or we need to loop through all owners and members and delete them one by one?

milanholemans commented 1 month ago

AFAIK there is no direct way to achieve this. We should retrieve all members and decide for ourselves which members should be added and which should be removed. @MartinM85 created something similar in https://github.com/pnp/cli-microsoft365/pull/5865 which is working great as far as I could test.

MathijsVerbeeck commented 1 month ago

@milanholemans Question, we are currently also in the process of adding other features to this command (#6059). wouldn't it be good to wait until this PR is merged to avoid conflicts? It should be merged somewhere this week.

nanddeepn commented 1 month ago

Thanks @MathijsVerbeeck I will wait for #6059 to get merged.