Change Primary Administrator of SharePoint Online Site using PnP PowerShell

Changing the Primary Administrator

First connect to SharePoint Online admin center

$connection = Connect-PnPOnline -Url https://YourTenant-admin.sharepoint.com -Credentials (Get-Credential) -ReturnConnection

Then get the Site

$site = Get-PnPTenantSite -Url https://YourTenant.sharepoint.com/sites/SiteAlias -Connection $connection

Then update the Owner (same as Primary Administrator) using the new Primary Administrators Email/UserPrincipalName.

$site.Owner = "user@domain.com"
$site.Update()
$site.Context.ExecuteQuery()

Verifying the Primary Administrator

Connect to SharePoint Online admin center

$connection = Connect-PnPOnline -Url https://YourTenant-admin.sharepoint.com -Credentials (Get-Credential) -ReturnConnection

Then get the Site

$site = Get-PnPTenantSite -Url https://YourTenant.sharepoint.com/sites/SiteAlias -Connection $connection

And Print the Owner (same as Primary Administrator)

$site.Owner

Leave a Reply

  • Your email address will not be published.
  • Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: