Forum Discussion

coxygt's avatar
coxygt
Brass Contributor
Sep 24, 2024

Adding an Entra Group as Site Collection Admins to all sites in SharePoint online

I am trying to get an Entra Group added as SCA to every SPO site in my tenant, I have found the claim ID for the Group but when the script is run using an account with SharePoint Admin, some sites work, some fail with various errors, below is a few:

  • Failed: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
  • Failed: User cannot be found.
  • Failed: Attempted to perform an unauthorized operation.
  • Failed: The underlying connection was closed: An unexpected error occurred on a receive.
  • Failed: The underlying connection was closed: A connection that was expected to be kept alive was closed by the server.

I am struggling to see why this fails, I am SharePoint Admin, have connected to sposervice ok, sure this was run a few years ago without issue, there are just over 9,500 sites showing in SP Admin.

  • Barbarur's avatar
    Barbarur
    Brass Contributor
    It's better if you share a minimum reproducible example of the script you are using and share the full error, and in which command the issue occurs.

    As alternative you can use this free and open-source application, which can handle adding an account as SCA across all sites in the tenant; https://github.com/Barbarur/NovaPoint

Resources