SharePoint Online is a powerful platform for collaboration and content management within organizations. Site administrators play a crucial role in managing site collections, ensuring security, and overseeing various administrative tasks. While every site collection should have at least one administrator, there are situations where it's essential to have multiple administrators to distribute responsibilities effectively. 


With LinkFixer Advanced, there are cases when multiple SharePoint Online site collection administrators are to be used to mitigate throttling. Please see How does LinkFixer Advanced cope with SharePoint Online Throttling, for more information. 


In this article, we'll explore how to add multiple site collection admin accounts, across multiple SharePoint Online site collections, via PowerShell.


  1. Open PowerShell as administrator
  2. Ensure SharePoint Online Management Shell is Installed
    Install-Module -Name Microsoft.Online.SharePoint.PowerShell -Force
  3. Create an import CSV file, containing site collections, and SharePoint Online accounts that are to-be site collection admins
    Sample CSV:
    Notes:
    • Column 1 header should be "SiteUrl". This can certainly be changed, as long as the values in the PowerShell script are changed to match the headers.
    • Column 2 header should be "SiteCollectionAdmin" to match the PowerShell script. This can certainly be changed, as long as the values in the PowerShell script are changed to match the headers.
    • Each row requires one site collection in column A, and the SharePoint Online email address in column B.
    • Multiple SharePoint Online emails can be added to the same site collection, as long as the site collection name is duplicated in column A.
  4. PowerShell script
    Import-Module Microsoft.Online.SharePoint.PowerShell
     
    #Parameters
    $TenantAdminURL = "https://company-admin.sharepoint.com"
    $CSVFilePath = "D:\Computer\PowerShell Scripts\SiteCollectionAdmin.csv"
     
    Try {
        #Connect to Admin Center
        Connect-SPOService -Url $TenantAdminURL
     
        #Get data from the CSV file
        $CSVData = Import-Csv $CSVFilePath
     
        #Iterate through each row in the CSV
        ForEach($Row in $CSVData)
        {
            Try{
                #Add Site collection Admin
                Set-SPOUser -site $Row.SiteURL -LoginName $Row.SiteCollectionAdmin -IsSiteCollectionAdmin $True | Out-Null
                Write-host "Added Site collection Administrator to $($Row.SiteURL)" -f Green
            }
            Catch {
                write-host -f Yellow "`tError Adding Site Collection Admin to $($Row.SiteURL) :" $_.Exception.Message
            }
        }
    }
    Catch {
        write-host -f Red "`tError:" $_.Exception.Message
    }

    Specifics:

    • Import-Module Microsoft.Online.SharePoint.PowerShell will require a SharePoint Admin account be used to login, via O365 web authentication. Enter the email address and password explicity, and avoid selecting pre-saved accounts.
    • $TenantAdminURL = "https://company-admin.sharepoint.com" is your organization's SharePoint Admin site.
    • $CSVFilePath = "D:\Computer\PowerShell Scripts\SiteCollectionAdmin.csv" is the file path of your saved CSV file from item 3.
  5. Verify the SharePoint Online accounts have been added to a handful of SharePoint Online site collections
    1. Navigate to Site Settings: Log in to your SharePoint Online site collection and click on "Settings" (the gear icon) in the top-right corner. Select "Permissions" and then "Advanced Permission Settings."
    2. Select "Site Collection Administrators" at top menu, and verify if the SharePoint Online accounts have been added.
  6. Best Practices
  7. Conclusion
  8. Related Articles