Skip to content

[BUG] Sites.Selected permission in App Only context not working properly #5169

@eprach

Description

@eprach

Reporting an Issue or Missing Feature

I have an app registration with Sites.Selected permission for Graph and SharePoint Online

Image

On a specific SharePoint site, I have assigned full control using the "Grant-PnPAzureADAppSitePermission" to my app registration.
Checking with Get-PnPAzureADServicePrincipalAssignedAppRole and Get-MgSitePermission, all good the permission is set.

Now I try to run the following commands, all of them result with "Attempted to perform an unauthorized operation":

  • Invoke-PnPSiteTemplate
  • Rename-PnPTenantSite
  • New-PnPList
  • Set-PnPList
  • Set-PnPListPermission
  • Add-PnPFolder

Expected behavior

Once connected with Connect-PnPOnline -Url "siteUrl" -ClientId xxxx -Tenant xxx.onmicrosoft.com -CertificatePath 'C:\TEMP\xxx.pfx'
The commands should work because my app registration has full control through the Sites.Selected.

Running my script with my App registration having "Sites.FullControl.All" on Graph and SharePoint Online works well so it is not an issue in my script.

Actual behavior

See description above

Steps to reproduce behavior

See description above

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

3.1.0

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

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

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