Change functionality of `entra m365group set` when specifying users
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]
Since we have v8 branch we may now start working on it! Let's get this 🚢 and Let's put CLI to the 🚀🌙
Can I work on it?
Hi, Should the PR be targeted to v9 or main branch?
Hi, Should the PR be targeted to v9 or main branch?
Since we consider this a breaking change it should be targeted to v9
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?
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 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.
Thanks @MathijsVerbeeck I will wait for #6059 to get merged.
@nanddeepn This PR has been merged in the meantime.