SYNOPSIS
Builds an inventory report of every SharePoint Online site of the tenant using PnP.PowerShell app-only.SYNTAX
DESCRIPTION
Get-SPOSiteReport collects the configuration of the SharePoint Online sites: storage quota and usage, site collection administrators, external sharing settings, sensitivity label, default sharing links, conditional access policy and hub site membership. The function connects with PnP.PowerShell in app-only mode (Entra app registration plus a certificate). This is the only reliable way to read site-level data (site collection administrators, site groups, regional settings) across every site of the tenant: the SharePoint Administrator role alone grants access to the admin center, not to the content of each site, so a delegated connection returns Access Denied on Get-PnPSiteCollectionAdmin. An app registration holding the SharePoint Sites.FullControl.All application permission bypasses the site collection admin requirement. Client secrets are not supported by SharePoint for app-only: a certificate is mandatory. Provide it through CertificateThumbprint (Windows certificate store), CertificatePath (.pfx file) or CertificateBase64Encoded (base64 string, handy for Azure Automation or a pipeline variable). The site-level collection runs in parallel (ForEach-Object -Parallel) with one PnP connection per site. Tune the concurrency with ThrottleLimit. PowerShell 7 is required. Optional switches enrich the report:- IncludeSiteAdmins adds the full list of site collection administrators of each site.
- RegionalSettingsDetails adds the time zone, hour format and locale of each site.
- SharingRightsAdminOrFullControl adds, best effort, the members of the site groups holding Full Control.
- M365GroupsDetails adds the Microsoft 365 group and Microsoft Teams layer. This layer relies on Exchange Online (Get-UnifiedGroup) and the MicrosoftTeams module (Get-Team), which are NOT covered by the PnP app-only certificate: connect Exchange Online and Microsoft Teams separately beforehand.