0

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?

dev123
  • 25
  • 1
  • 9

1 Answers1

0

These sensitivity labels would be coming from the Microsoft Purview products. That has its own role based access control: https://pnp.github.io/powershell/cmdlets/Get-PnPAvailableSensitivityLabel.html#description

Have you checked if your account has the correct Microsoft Purview permissions? https://learn.microsoft.com/en-us/microsoft-365/compliance/microsoft-365-compliance-center-permissions?view=o365-worldwide#permissions-needed-to-use-features-in-the-compliance-portal

Expiscornovus
  • 1,222
  • 1
  • 3
  • 7