For internal audit /validation do I need to load all sites in my tenant where the classification of the site is set to "Internal Only" (custom classification created for our tenant).
It seems like that I cannot retrieve the classification using the standard PowerShell module Microsoft.Online.SharePoint.PowerShell - the object returned by Get-SPOSite simply does not provided a property Classification.
The only way I have found is using PnP.PowerShell, see Microsoft documentation Programmatically read the classification of a site:
Connect-PnPOnline "https://[tenant].sharepoint.com/sites/[modernsite]" -Credentials [credentials]
$site = Get-PnPSite
$classificationValue = Get-PnPProperty -ClientObject $site -Property Classification
Write-Host $classificationValue
But the problem with the PnP.PowerShell based approach is the fact that I need be be an admin /owner of that site in order to load the site-object. I case I am not an admin /owner is the following error raised when executing Get-PnPSite:
Get-PnPSite : The remote server returned an error: (401) Unauthorized.
Question is now if I could retrieve the classification of all sites in my tenant without being a site-collection administrator?