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.
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. Read More