Skip to content
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

[FEATURE] Get-PnPTeamsTeam -User #4749

Open
azureskydiver opened this issue Feb 21, 2025 · 2 comments
Open

[FEATURE] Get-PnPTeamsTeam -User #4749

azureskydiver opened this issue Feb 21, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@azureskydiver
Copy link

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Using PnP, there doesn't to be an efficient way to find out which teams a particular user belongs to if there are thousands of teams within a tenant.

Describe the solution you'd like
Create the equivalent of the Teams PowerShell module's Get-Team -User <upn> command.

Describe alternatives you've considered
The obvious approach restricting myself to just using PnP is to use Get-PnPTeamsTeam to first get all the Teams with the tenant, and then pipe that into Get-PnPTeamsUser to get all the members of each team, and then checking to see if the is in that list of members.

If I don't restrict myself to using just the PnP modules, the Microsoft Teams module offers the Get-Team cmdlet which takes a -User parameter for just getting the teams for which the user belongs to. The Azure AD modules also offer cmdlets to search for which AD groups a user belongs to.

Is there currently a way of solving your problem with existing cmdlets? Optionally through the use of other PowerShell Modules (for instance by using the Microsoft Graph cmdlets or the Microsoft SPO Management Shell)
The obvious approach restricting myself to just using PnP is to use Get-PnPTeamsTeam to first get all the Teams with the tenant, and then pipe that into Get-PnPTeamsUser to get all the members of each team, and then checking to see if the is in that list of members.

If I don't restrict myself to using just the PnP modules, the Microsoft Teams module offers the Get-Team cmdlet which takes a -User parameter for just getting the teams for which the user belongs to. The Azure AD modules also offer cmdlets to search for which AD groups a user belongs to.

Additional context
Our tenant has over 20000 Teams.

@azureskydiver azureskydiver added the enhancement New feature or request label Feb 21, 2025
@jackpoz
Copy link
Contributor

jackpoz commented Feb 22, 2025

https://learn.microsoft.com/en-us/graph/api/user-list-memberof?view=graph-rest-1.0&tabs=http is a more direct way to get all the groups a user is member of. You can filter by Unified group types (M365 groups) and then check if they have Teams enabled.

@azureskydiver
Copy link
Author

azureskydiver commented Feb 22, 2025

Oh! I see. I can use:
Invoke-PnPGraphMethod

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants