I'm using PnP Powershell module to call 'Get-PnPAvailableSensitivityLabel'. This cmdlet allows retrieval of the available Microsoft Purview sensitivity labels in the currently connected tenant (https://pnp.github.io/powershell/cmdlets/Get-PnPAvailableSensitivityLabel.html).
When running this:
Connect-PnPOnline -Url $tenantAdminUrl
$sensitivityLabels = Get-PnPAvailableSensitivityLabel
Write-Output($sensitivityLabels)
I receive the following error:
Get-PnPAvailableSensitivityLabel : Access denied. Check for the required permissions.
At line:2 char:22
+ $sensitivityLabels = Get-PnPAvailableSensitivityLabel
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Get-PnPAvailableSensitivityLabel], PSInvalidOperationException
+ FullyQualifiedErrorId : InvalidOperation,PnP.PowerShell.Commands.Purview.GetAvailableSensitivityLabel
Has anyone else experienced this and know a fix please? Error suggests permissions, however the account I'm connected with is global admin.
I've run the following command and have consented to the app permissions request but that hasn't fixed the issue.
Register-PnPManagementShellAccess
Anything else I need to do?