-
Notifications
You must be signed in to change notification settings - Fork 326
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
Bug report: Retrieving members for M365 group via entra m365group user list leads to unexpected result #6382
Comments
Hey @tmaestrini, thanks for reporting this. What you're describing seems to be by design, so it's not really a bug. If you check the docs for |
Let's say I have a group with 2 members in my tenant. One member is from my tenant, the second member is external (guest) user. When running
returns correctly both members, but then filtering by The issue is this filtering
I'm also worried about this line It overrides |
This assumption isn't quite right because you can specify the
Good catch, we definitely shouldn't do that. If I’m not mistaken, this was updated in |
Like @Jwaegebaert mentioned the |
Priority
(Medium) I'm annoyed but I'll live
Description
As discussed with @milanholmans in Pull Request #6250, I've encountered an unexpected behavior while trying to retrieve the members from an m365 group.
While this seems to be normal behavior at first sight, digging into the code returned a filter statement that let me open this issue.
Steps to reproduce
Consider the following scenario: in my Entra ID, I have an M365 Group with id
db8ac02c-fc83-4fca-b090-42f3cbe8b492
. While the group consists of 20 members in total, there is only 1 owner and two external identities (aka "guests").Members with the role
member
can be retrieved using following two approaches:Expected results
Since we know that group owners also count as members, both approaches should return the same number of group members (which includes both owners and members as well as guests): 20.
Actual results
Unfortunately, the two approaches lead to different results:
While
$membersRole
only contains members that match the rolemembers
,$membersRole2
also contains guests.Diagnostics
The code analysis revealed that the command
m365 entra m365group user list --role Member
(see link to the git repo) contains a filter statement at the end of the corresponding method, which filters the result set for members along theiruserType
(that was set via therole
cli parameter):This leads to the unexpected result, which differs from this statement:
$allGroupMembers | Where-Object { $_.roles -contains "Member" }
, because filtering the result along therole
option only returns a subset of all the members.Conclusion
To me, filtering out the external identities from the result set when searching for group members totally makes sense on one hand (and is also a "convenient" way to having a "proper" list of members not containing any guest).
But on the other hand, as Microsoft includes the external users when displaying them in the group overview in Entra ID, the external users also should be included in the return value of the m365 cli command.
That said, imo either the documentation could be updated, or the filter clause should be removed.
What do you think? Am I missing something important?
CLI for Microsoft 365 version
v9.0.0
nodejs version
v18.19.1
Operating system (environment)
macOS
Shell
PowerShell
cli doctor
Additional Info
No response
The text was updated successfully, but these errors were encountered: