SharePoint Online: How to Change Site Owner using PowerShell?

Requirement: Change Site Owner in SharePoint Online using PowerShell

How to Change Site Owner in SharePoint Online?

Site Owners of a SharePoint Online site collections can be changed only through SharePoint Online Admin Center or PowerShell. To change site owner in SharePoint Online follow these steps:

Important: You must be either Global Administrator or SharePoint Online Administrator to change site owners in SharePoint Online!
  • Sign in to Office 365 Admin Center (, Click on “SharePoint Admin Center” link from “Admin Centers” section. 
  • You’ll be landing to Site Collections list in SharePoint Admin center ( with all site collections listed. 
  • Select the site collection from the list of site collections to which you want to change the site owner >> From the ribbon, Click on “Owners” and then “Manage Administrators”
  • On the “Manage Administrators” dialog box, You can change the primary site collection administrator – Site owner. You can also configure additional site collection administrators. Enter the name for primary site collection administrator and Click OK save your changes.
    change site owner sharepoint online powershell

You can add only ONE site owner (Primary Site Collection Admin) in SharePoint Online! There is no secondary admin in SharePoint Online, but you can add more than one “Site collection Administrators”. Now, let’s see how to change site owner in SharePoint Online using PowerShell.

Change Site Owner SharePoint Online using PowerShell

We can change the site owner using Set-SPOSite cmdlet. Here is an example: Set the variables according to your environment.

$AdminCenterURL = ""
$SiteOwner = "[email protected]"
#Connect to SharePoint Online
Connect-SPOService -url $AdminCenterURL -Credential (Get-Credential)
#sharepoint online powershell set site owner
Set-SPOSite -Identity $SiteCollURL -Owner $SiteOwner -NoWait

Set Site Owner using PnP PowerShell

Use this PowerShell script to set site owner

$AdminCenterURL = ""
$SiteURL = ""
$SiteOwner= "[email protected]"
#Connect to PnP Online
Connect-PnPOnline -Url $AdminCenterURL -UseWebLogin

#Get the Site Collection
$Site = Get-PnPTenantSite -Url $SiteURL

#Set site owner
$Site.Owner = $SiteOwner

Change Site Owner for All Site Collections in the Tenant:

Make sure you set the parameters according to your environment and run the script:

Step 1: Connect to SharePoint Online

$AdminCenterURL = ""
$SiteOwner = "[email protected]"

#Connect to Tenant Admin
Connect-SPOService -Url $AdminCenterURL

This cmdlet prompts you for credentials. Enter the Administrator’s credentials.

Step 2: Update Site Owner for all site collections

#Get all site collections 
$SiteCollections = Get-SPOSite -Limit ALL -includepersonalsite $False

#Loop through each site collection
ForEach($Site in $SiteCollections)
   #sharepoint online powershell change site owner
   Set-SPOSite -Identity $Site.url -Owner $SiteOwner

You can verify the site owners with cmdlet:

Get-SPOSite | Select url, owner

Here is my another post on adding site collection administrators to SharePoint Online: PowerShell to Add Site Collection Administrators in SharePoint Online

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

Leave a Reply