Skip to content

[BUG] Get-PnPAvailableSensitivityLabel: Forbidden (403): #5135

@jamesaepp

Description

@jamesaepp

Reporting an Issue or Missing Feature

Issue in documentation and maybe code

Expected behavior

According to https://pnp.github.io/powershell/articles/permissionattributes.html , a warning should occur if the permission isn't present:

permissions are checked before the cmdlet is executed. If the user does not have the required permissions, the cmdlet will throw a warning

It appears dev commit dab0c43 was made under #4488 to include the required permissions but I don't see it in the 3.1.0 code: https://github.com/pnp/powershell/blob/772fdeba257537fe2bb89431d71df5bf708c6d32/src/Commands/Purview/GetSiteSensitivityLabel.cs

Actual behavior

> Get-PnPAvailableSensitivityLabel -Verbose -Debug
VERBOSE: Cmdlet execution started for Get-PnPAvailableSensitivityLabel -Verbose -Debug
Get-PnPAvailableSensitivityLabel: Forbidden (403):

Steps to reproduce behavior

Get-PnPAvailableSensitivityLabel with an app registration without the required

What is the version of the Cmdlet module you are running?

3.1.0

Which operating system/environment are you running PnP PowerShell on?

  • Windows
  • Linux
  • MacOS
  • Azure Cloud Shell
  • Azure Functions
  • Other : please specify

Context

I am filling/working this on my personal time and in my private capacity. This issue is spawned by the issue occurring in my employer's environment. I am not a PnP expert by any stretch, I don't often make github issues/PRs. Be gentle.

Our App Registration didn't include the InformationProtectionPolicy.Read API as documented in #2233. As such, we got this Forbidden error until I found that issue and updated our app reg. Had it not been for that issue, I would've been lost as to what to do.

My intent is to follow this issue up with a PR for the documentation. But soliciting help/feedback from experienced contributors as to if this Forbidden 403 is the expected behavior when permissions are missing. 403 is certainly very helpful, but not very communicative.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions