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