Forum Discussion
Error when using trying to publish/deploy spfx package to Apps catalog in a site collection
Hi there,
I have created an appcatalog scoped for a site collection(not in a root site) url like this
App Catalog URL
https://sitename.sharepoint.com/sites/Dev/AppCatalog
I have tried the following to try and add and deploy the spfx package it but no luck.
- First i uploaded the package manually (When uploaded it doesn't even prompt for anyway to deploy it)
Second way through script
The AppCatalog url below is the site collections
$AppCatalogURL = "https://xxxx.sharepoint.com/sites/Dev"
$AppFilePath = "C:\react-carousel.sppkg"
#Connect to SharePoint Online App Catalog site
Connect-PnPOnline -Url $AppCatalogURL -UseWebLogin
#Add App to App catalog
$App = Add-PnPApp -Path $AppFilePath
#Deploy App to the Tenant
Publish-PnPApp -Identity $App.ID -Scope Site
I get the error below
Add-PnPApp : {"error":{"code":"-2147024891,
System.UnauthorizedAccessException","message":{"lang":"en-US","value":"Access denied. You do not have permission
to perform this action or access this resource."}}}
At C:\AddPackage.ps1:9 char:8
+ $App = Add-PnPApp -Path $AppFilePath
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [Add-PnPApp], Exception
+ FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Apps.AddApp
Publish-PnPApp : Cannot bind argument to parameter 'Identity' because it is null.
At C:\AddPackage.ps1:12 char:26
+ Publish-PnPApp -Identity $App.ID -Scope Site
+ ~~~~~~~
+ CategoryInfo : InvalidData: (:) [Publish-PnPApp], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,SharePointPnP.PowerShell.Commands.App
s.PublishApp
This one below is using the full AppCatalog url
$AppCatalogURL = "https://xxxx.sharepoint.com/sites/Dev/AppCatalog"
$AppFilePath = "C:\react-carousel.sppkg"
#Connect to SharePoint Online App Catalog site
Connect-PnPOnline -Url $AppCatalogURL -UseWebLogin
#Add App to App catalog
$App = Add-PnPApp -Path $AppFilePath
#Deploy App to the Tenant
Publish-PnPApp -Identity $App.ID -Scope Site
I get Error below
Add-PnPApp : Cannot contact site at the specified URL https://xxx.sharepoint.com/sites/Dev/AppCatlog.
There is no Web named "/sites/Dev/AppCatlog/_vti_bin/sites.asmx".
At C:\AddPackage.ps1:9 char:8
+ $App = Add-PnPApp -Path $AppFilePath
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [Add-PnPApp], ClientRequestException
+ FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Apps.AddApp
Publish-PnPApp : Cannot bind argument to parameter 'Identity' because it is null.
At C:\\AddPackage.ps1:12 char:26
+ Publish-PnPApp -Identity $App.ID -Scope Site
+ ~~~~~~~
+ CategoryInfo : InvalidData: (:) [Publish-PnPApp], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,SharePointPnP.PowerShell.Commands.App
s.PublishApp
- Do you have access to the Global App Catalogue as Admin? If no, that's the cause of your access denied error
7 Replies
- Lalit MohanIron ContributorHi Patrick Rote Possible causes for errors when attempting to publish or deploy an SPFx package to the Apps catalog in a site collection include insufficient permissions and package validation issues. Thanks Lalit Mohan.
Patrick Rote Are you a Site Collection Admin? Also, try leaving the "AppCatalog" off the url in the Connect-PnPOnline command script. If the site app catalog was created via PowerShell or by adding it in the UI with the App Catalog template, the Site Collection knows where to deploy.
- Patrick RoteIron Contributor
Don Kirkham thanks for the response
Yes i am a site collection admin
Correct as you can see in my script the second option had Connect-PnPOnline had the AppCatalog off the url but still getting the error here.
The error is on the line - "+ $App = Add-PnPApp -Path $AppFilePath" belowAdd-PnPApp : {"error":{"code":"-2147024891,
System.UnauthorizedAccessException","message":{"lang":"en-US","value":"Access denied. You do not have permission to
perform this action or access this resource."}}}
At C:\\AddPackage.ps1:9 char:8
+ $App = Add-PnPApp -Path $AppFilePathAny thoughts?
- Do you have access to the Global App Catalogue as Admin? If no, that's the cause of your access denied error