Skip to content

[BUG] - Add-PnPApp, Get-PnPSiteCollectionAppCatalog require SharePoint Admin permission #5073

@a1mery

Description

@a1mery

Reporting an Issue or Missing Feature

A a site admin If I try to add a .sppkg file to a site app catalog (using Add-PnPApp) I'm having an error.
It works fine if I'm SharePoint admin.
It works fine if I'm doing it from the UI interface (without being a SharePoint admin)

Expected behavior

If I'm site admin:
Add-PnPApp -Path '' -Scope Site adds my .sppkg file to the site app catalog even if I'm not SharePoint Admin
Get-PnPSiteCollectionAppCatalog -CurrentSite return a "successful" result

Actual behavior

PS C:\Windows\System32> Add-PnPApp -Path "C:\Users\adelevance\webpart.sppkg" -Scope Site
Add-PnPApp: Unable to connect to the SharePoint Online Admin Center at 'https://xxxx-admin.sharepoint.com' to run this cmdlet. If this URL is incorrect for your tenant, you can pass in the correct Admin Center URL using Connect-PnPOnline -TenantAdminUrl. If you are using Privileged Identity Management (PIM) on your tenant, please ensure you have activated at least the SharePoint Administrator role and allowed some time for it to activate. Error message: Attempted to perform an unauthorized operation.

Steps to reproduce behavior

Connect-PnPOnline -Url "Url of a site" -ClientId "xxxx-xxx"
Add-PnPApp -Path "C:\Users\adelevance\webpart.sppkg" -Scope Site

The app registration has "AllSites.FullControl" Delegated permission.

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

3.1.142

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

  • Windows
  • Linux
  • MacOS
  • Azure Cloud Shell
  • 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