pnp / powershell

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

[BUG] Get-PnPUser -WithRightsAssigned times out while working with some sites #3162

Open Nazul opened 1 year ago

Nazul commented 1 year ago

Expected behavior

Get-PnPUser -WithRightsAssigned should return the list of users with rights assigned.

Actual behavior

Get-PnPUser -WithRightsAssigned times out. image

Steps to reproduce behavior

  1. Connect to a SharePoint site
  2. Run Get-PnPUser -WithRightsAssigned, which fails

Alternate path

  1. Connect to a SharePoint site
  2. Get current context and change timeout value
  3. Get-PnPUser -WithRightsAssigned stills fails after running for about 1:53-1:55 minutes

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

This was tested with 1.12.0 (Windows PowerShell 5.1) as well as with 2.1.1 (PowerShell 7.3.4)

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

veronicageek commented 1 year ago

@Nazul - Can you try on another site? I have no issue on my side (using 2.1.69 nightly)

image

Nazul commented 1 year ago

I thought that I mentioned. It doesn't fail with all sites, but just with some. For those where it fails, it fails with both 1.12.0 and 2.1.1 versions.

veronicageek commented 1 year ago

In that case it might be more of an issue with the backend, and there are currently some issues with M365 (details in the tenant admin center). If it works even for some sites, not sure we can do anything unfortunately.

Nazul commented 1 year ago

We are aware of the Microsoft services outage, however, the issue we described occurred before the outage according to our logs, and it is still there even though SharePoint is listed as fully operational today for our tenant.

The problem that I see related with Get-PnPUser is that we have no way to modify the timeout value, so we can wait longer for the operation to be completed.

veronicageek commented 1 year ago

Well, I'll leave @gautamdsheth or @KoenZomers look at it then.

patritasan commented 1 year ago

I'm facing same issue. In my case I'm using PowerShell 7.3.7 and PnP.PowerShell 2.2.0 Do we have any news about possible solution?

danny-yehya commented 1 week ago

While I am not getting the specific timeout error directly, we are getting "Get-PnPUser: Maximum retry attempts 10, has be attempted." whenever this is run on the base site https://_tenant_.sharepoint.com . This tenant has about 45K active users, and the total user count based on some other things run shows approximately 87K users.

This needs to be able to handle throttling and retries better. I did not go through all the code to see how it is internally managing but with a large active tenant, the code should be able to respect throttling from SharePoint and retry based on that.