pnp / powershell

PnP PowerShell
https://pnp.github.io/powershell
MIT License
621 stars 331 forks source link

[BUG] Get-PnPMicrosoft365Group -IncludeSiteUrl -IncludeOwners errors due to token expiration on tenants with 4K+ M365 Groups #4051

Open joerodgers opened 1 week ago

joerodgers commented 1 week ago

Reporting an Issue or Missing Feature

Due to the access token being passed in as a string to the Microsoft365GroupsUtility.GetGroupsAsync function, on large tenants the operation can take several minutes to complete, sometimes exceeding the expiration time of the provided (stale?) access token.

Get-PnPMicrosoft365Group -IncludeSiteUrl -IncludeOwners

Expected behavior

The cmdlet will automatically refresh any expired access tokens and allow the operation to succeeded. I potential short term option would be to force a token refresh before passing it over to Microsoft365GroupsUtility.GetGroupsAsync, allowing a much longer period of time before token expiration.

What is the version of the Cmdlet module you are running?

1.12.0

Which operating system/environment are you running PnP PowerShell on?

gautamdsheth commented 1 week ago

@joerodgers - can you please try with the latest version and let us know ? Its quite old and the latest version is 2.4.0 which has quite a few changes and updates.

tomtorggler commented 6 days ago

I might have the same issue, Get-PnPMicrosoft365Group hangs when I use the switch -IncludeSiteUrl.

I tried 2.5.0 and 2.5.4-nightly on Windows.