cli-microsoft365 icon indicating copy to clipboard operation
cli-microsoft365 copied to clipboard

Change functionality of `entra m365group set` when specifying users

Open milanholemans opened this issue 1 year ago • 8 comments

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:

  • --owners [owners]
  • --members [members]

milanholemans avatar May 19 '24 11:05 milanholemans

Since we have v8 branch we may now start working on it! Let's get this 🚢 and Let's put CLI to the 🚀🌙

Adam-it avatar Jul 07 '24 01:07 Adam-it

Can I work on it?

nanddeepn avatar Jul 30 '24 14:07 nanddeepn

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

nanddeepn avatar Aug 04 '24 06:08 nanddeepn

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

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

Adam-it avatar Aug 04 '24 06:08 Adam-it

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?

nanddeepn avatar Aug 13 '24 14:08 nanddeepn

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.

milanholemans avatar Aug 13 '24 15:08 milanholemans

@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.

MathijsVerbeeck avatar Aug 13 '24 16:08 MathijsVerbeeck

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

nanddeepn avatar Aug 13 '24 16:08 nanddeepn

@nanddeepn This PR has been merged in the meantime.

MathijsVerbeeck avatar Sep 17 '24 21:09 MathijsVerbeeck