Many scripts that find a SharePoint site owner still load the AzureAD module. That module is retired, and those scripts also miss the real owners of sites connected to a Microsoft 365 group.
The better way is PnP PowerShell. Run Get-PnPTenantSite -Identity <site URL> -Detailed and read Owner. If the site has a GroupId, run Get-PnPMicrosoft365GroupOwner on that ID, because the group’s owners are the people who actually own the site.
In this tutorial, we’ll cover every get SharePoint site owner PowerShell task I run during tenant cleanups: the owner of one site, the owners of a group site, site collection admins, the Get-SPOSite way and a CSV report for every site.
The sample sites we’ll use
I ran every PnP example here against my own tenant. You’ll need PnP PowerShell in PowerShell 7 and your own Entra ID app; my guide to installing PnP PowerShell for SharePoint Online covers both.
Connect to the SharePoint admin center first:
$adminUrl = "https://spguides-admin.sharepoint.com"
$clientId = "00000000-0000-0000-0000-000000000000" # your Entra ID app's client ID
Connect-PnPOnline -Url $adminUrl -ClientId $clientId -Interactive
We’ll use two sites, because SharePoint stores ownership differently in each:
- SPGuides News: a communication site, no group (SITEPAGEPUBLISHING#0).
- SPGuides: a team site with a Microsoft 365 group (GROUP#0).
Method 1: Get the Owner of a Non-Group Site with Get-PnPTenantSite (Recommended)
For a site without a group, the owner is the site’s primary admin. Here’s the command:
$siteUrl = "https://spguides.sharepoint.com/sites/SPGuidesNews"
Get-PnPTenantSite -Identity $siteUrl -Detailed |
Select-Object Title, Template, Owner, OwnerEmail, OwnerName, GroupId |
Format-List
For SPGuides News, it returns the owner and an empty GroupId:

How does this work?
Get-PnPTenantSite reads the site from the admin center, so you don’t need access to the site itself. Owner is the sign-in name, OwnerEmail the address and OwnerName the display name.
A GroupId of all zeros means no Microsoft 365 group, so Owner is the real answer.
So here’s the catch: -Detailed isn’t optional. In my tenant, a plain Get-PnPTenantSite call left Owner empty for 141 of 165 sites and OwnerEmail empty for all 165.
Method 2: Get the Owners of a Group-Connected Site with Get-PnPMicrosoft365GroupOwner
Run the same command against the SPGuides site, and Owner doesn’t look like a person:

9cc6ff72-…_o is the GroupId with _o added, which stands for the group’s owners. To see the people, ask the group. If you need the members too, see getting Microsoft 365 group members with PowerShell.
Here’s the command:
$site = Get-PnPTenantSite -Identity "https://spguides.sharepoint.com/sites/SPGuides"
Get-PnPMicrosoft365GroupOwner -Identity $site.GroupId |
Select-Object DisplayName, UserPrincipalName |
Format-Table -AutoSize
The SPGuides group has 4 owners, and every one of them owns the site: