question

TerryNaud-2690 avatar image
0 Votes"
TerryNaud-2690 asked TerryNaud-2690 answered

SharePoint Online Get-SPOUser IsSiteAdm Error 429

Is there another way to find Site Administrators in SharePoint Online?

I have tried the following but on some sites I get an error 429.

 Get-SPOUser -Site $SiteUrl -Limit All | select DisplayName,LoginName,IsSiteAdmin,IsGroup,@{n="Groups";e={$_.Groups -join ";"}}  | Export-Csv -nti "blabla.csv"


Most of the sites it fails on seem to use the "Everyone except external users" group and this would be in excess of 5000 users which I believe to be the problem.

office-sharepoint-onlinewindows-server-powershell
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

TerryNaud-2690 avatar image
0 Votes"
TerryNaud-2690 answered

Okay thank you again for your updated answer but that seems lot of trouble just to allow me to get a short list of site admins.

Been doing a lot of googling and finally managed to resolve the problem by using get-pnpuser instead.

 Get-PnPUser | ? IsSiteAdmin -eq $true

Regards

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

EchoDu-MSFT avatar image
0 Votes"
EchoDu-MSFT answered EchoDu-MSFT edited

@TerryNaud-2690

Yes, you are right.

By design, when a user exceeding usage limits or making too many requests within a single time, SharePoint will return "429 TOO MANY REQUESTS" error. It means SharePoint Online enforce Throttling limits function, in order to preserve service health.

You could refer to this article Avoid getting throttled or blocked in SharePoint Online to view more information.


=============================

@TerryNaud-2690

……………… Updated Answer ………………

Enforcing limits scope:

  • 10,000 SharePoint groups per site (site collection).

  • Each SharePoint group can have up to 5,000 users.

  • 5,000 role assignments per uniquely permissioned item.

Because users of the “Everyone except external users” group exceeds 5000 in your SharePoint Online. I suggest you could split "Everyone except external users" group into several groups. You can follow these steps:

1.You can group internal external by Departments, such as "Sales Dep", "Personnel Dep", "Finance Dep", etc.
2.Add users in the "Everyone except external users" group to the corresponding group.
3.Use these groups to replace the "Everyone except external users" group.
4.You could run the following commands in the SharePoint Online Management Shell as an admin:

 $admin = "username@aabc.onmicrosoft.com"
 $password = "****"
 $cred = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $admin, $(convertto-securestring $Password -asplaintext -force)
 Connect-SPOService -Url https://aabc-admin.sharepoint.com -Credential $cred
 $SiteURL= "https://aabc.sharepoint.com/sites/test1"
 Get-SPOUser -Site $SiteUrl -Limit All | select DisplayName,LoginName,IsSiteAdmin,IsGroup,@{n="Groups";e={$_.Groups -join ";"}} | Export-Csv "D:\report.csv"

Thanks,
Echo Du
=================
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.















5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

TerryNaud-2690 avatar image
0 Votes"
TerryNaud-2690 answered EchoDu-MSFT commented

Thank you for your answer, I have already looked at the Throttling limits page several times to try and work out a way around this but not having much luck.

So my question was to see if somebody had found a solution for getting Site Admins by any other means using a powershell script.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@TerryNaud-2690

I have updated my Answer.

You can directly click “Comment” option under ”My Answered“ to put forward your opinions and thoughts about solution
that I propose.

Thanks,
Echo Du

0 Votes 0 ·