powershell: [BUG] In Add-PnPApp overwrite is not working throws error The current user does not have the permission to access the App Catalog.

Reporting an Issue or Missing Feature

Not able to overwrite existing app in a SP site collection app catalog even though I have given full control to the registered app for authentication.

Expected behavior

The app should get overwritten

Actual behavior

Throwing the error says The current user does not have the permission to access the App Catalog.

Steps to reproduce behavior

Try the below Created an app in a SharePoint site using /_layouts/appregnew.aspx

provided below access using /_layouts/appinv.aspx <AppPermissionRequests AllowAppOnlyPolicy="true"> <AppPermissionRequest Scope="http://sharepoint/content/sitecollection" Right="FullControl" /> </AppPermissionRequests>

Then run the below command

Connect-PnPOnline -Url https://sites.xxxx.com/sites/xxxxxxx -ClientId “xxxxx” -ClientSecret “xxxxx”

Add-PnPApp -path “C:\Projects\xxx\Backups\xxxxx.sppkg” -Scope Site

check the app uploaded to the Site collection level app catalog then try the below command

Add-PnPApp -path “C:\Projects\xxx\Backups\xxxxx.sppkg” -Scope Site -Overwrite

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

(you can retrieve this by executing Get-Module -Name "PnP.PowerShell" -ListAvailable)

ModuleType Version Name


Manifest 1.10.0 PnP.PowerShell

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

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

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 5
  • Comments: 17

Most upvoted comments

hey all in this thread , this issue has been fixed. We missed some stuff when we added code to handle no-script sites facing issues uploading/publishing the app. Fix will be available starting with tomorrow’s nightly builds as well as in the next major , thanks for reporting !

I made it: SPFx-DeploySolutions.ps1 No PnP PowerShell, just pure SharePoint Rest API

I’m calling it from AzurePowerShell task in order to use AzureContext from the ServiceConnection with Workload Identity Federation.

task: AzurePowerShell@5
          name: deploySPFxSolution
          inputs:
            azureSubscription: ${{parameters.serviceConnection}}
            azurePowerShellVersion: LatestVersion
            ScriptType: FilePath
            ScriptPath: $(scriptsDir)/SPFx-DeploySolutions.ps1
            ScriptArguments: >
              -tenantName '$(Az_TenantName)'
              -siteName '$(SPO_SiteName)'
              -folderPath '$(artifactsLocation)'

The ServicePrincipal used for the Workload Identity has Sites.Selected and fullcontrol on the site collection. This is required to add an app. No permissions to the tenant-level app catalog, nor Admin Center required =)

Would certainly be nice if the situation in the tenant stabilized and the PnP PowerShell worked reliably again, but for now I will stick with the basics.

@Piotrek1697 Same here, I get same error message as well when running:

Add-PnPApp -Path ./myapp.sppkg -Scope Site -Publish

As this is -scope site, it makes no sense to connect with SharePoint Admin center… is more people experiencing the same issue? is this a bug?

Thanks

I’m facing this issue while trying to add an app to the site collection app catalog for the first time, logged with ClientId and CertificatePath. Someone has any idea how to resolve this?

Image

This should be resolved now

I don’t have access to the tenant app catalog, hence I cannot run the above commands.

By resolved I actually meant that it should not anymore require to give explicit access to the tenant app catalog - it should work like it did last week 😃

We are experiencing the same issue today with our weekly automated deployment. We deploy to our Site Catalog. We found that our SPN now also requires Read access to the Tenant catalog. After that was added the deployment went through.