SOLVED

Error when using trying to publish/deploy spfx package to Apps catalog in a site collection

%3CLINGO-SUB%20id%3D%22lingo-sub-2117278%22%20slang%3D%22en-US%22%3EError%20when%20using%20trying%20to%20publish%2Fdeploy%20spfx%20package%20to%20Apps%20catalog%20in%20a%20site%20collection%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2117278%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20there%2C%3CBR%20%2F%3EI%20have%20created%20an%20appcatalog%20scoped%20for%20a%20site%20collection(not%20in%20a%20root%20site)%20url%26nbsp%3B%20like%20this%26nbsp%3B%3C%2FP%3E%3CP%3EApp%20Catalog%20URL%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fsitename.sharepoint.com%2Fsites%2FDev%2FAppCatalog%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fsitename.sharepoint.com%2Fsites%2FDev%2FAppCatalog%3C%2FA%3E%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EI%20have%20tried%20the%20following%20to%20try%20and%20add%20and%20deploy%20the%20%3CSTRONG%3Espfx%20package%3C%2FSTRONG%3E%20it%20but%20no%20luck.%3CBR%20%2F%3E-%20First%20i%20uploaded%20the%20package%20manually%20(When%20uploaded%20it%20doesn't%20even%20prompt%20for%20anyway%20to%20deploy%20it)%3CBR%20%2F%3ESecond%20way%20through%20script%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20AppCatalog%20url%20below%20is%20the%20site%20collections%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-html%22%3E%3CCODE%3E%24AppCatalogURL%20%3D%20%22https%3A%2F%2Fxxxx.sharepoint.com%2Fsites%2FDev%22%0A%24AppFilePath%20%3D%20%22C%3A%5Creact-carousel.sppkg%22%0A%20%0A%23Connect%20to%20SharePoint%20Online%20App%20Catalog%20site%0AConnect-PnPOnline%20-Url%20%24AppCatalogURL%20-UseWebLogin%0A%20%0A%23Add%20App%20to%20App%20catalog%0A%24App%20%3D%20Add-PnPApp%20-Path%20%24AppFilePath%0A%20%0A%23Deploy%20App%20to%20the%20Tenant%0APublish-PnPApp%20-Identity%20%24App.ID%20-Scope%20Site%20%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23FF0000%22%3E%3CSTRONG%3E%3CFONT%20color%3D%22%23000000%22%3EI%20get%20the%20error%20below%3C%2FFONT%3E%3C%2FSTRONG%3E%3CBR%20%2F%3EAdd-PnPApp%20%3A%20%7B%22error%22%3A%7B%22code%22%3A%22-2147024891%2C%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3ESystem.UnauthorizedAccessException%22%2C%22message%22%3A%7B%22lang%22%3A%22en-US%22%2C%22value%22%3A%22Access%20denied.%20You%20do%20not%20have%20permission%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3Eto%20perform%20this%20action%20or%20access%20this%20resource.%22%7D%7D%7D%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3EAt%20C%3A%5CAddPackage.ps1%3A9%20char%3A8%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3E%2B%20%24App%20%3D%20Add-PnPApp%20-Path%20%24AppFilePath%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3E%2B%20CategoryInfo%20%3A%20WriteError%3A%20(%3A)%20%5BAdd-PnPApp%5D%2C%20Exception%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3E%2B%20FullyQualifiedErrorId%20%3A%20EXCEPTION%2CSharePointPnP.PowerShell.Commands.Apps.AddApp%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3EPublish-PnPApp%20%3A%20Cannot%20bind%20argument%20to%20parameter%20'Identity'%20because%20it%20is%20null.%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3EAt%20C%3A%5CAddPackage.ps1%3A12%20char%3A26%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3E%2B%20Publish-PnPApp%20-Identity%20%24App.ID%20-Scope%20Site%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3E%2B%20~~~~~~~%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3E%2B%20CategoryInfo%20%3A%20InvalidData%3A%20(%3A)%20%5BPublish-PnPApp%5D%2C%20ParameterBindingValidationException%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3E%2B%20FullyQualifiedErrorId%20%3A%20ParameterArgumentValidationErrorNullNotAllowed%2CSharePointPnP.PowerShell.Commands.App%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3Es.PublishApp%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CBR%20%2F%3EThis%20one%20below%20is%20using%20the%20full%20AppCatalog%20url%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3E%24AppCatalogURL%20%3D%20%22https%3A%2F%2Fxxxx.sharepoint.com%2Fsites%2FDev%2FAppCatalog%22%0A%24AppFilePath%20%3D%20%22C%3A%5Creact-carousel.sppkg%22%0A%20%0A%23Connect%20to%20SharePoint%20Online%20App%20Catalog%20site%0AConnect-PnPOnline%20-Url%20%24AppCatalogURL%20-UseWebLogin%0A%20%0A%23Add%20App%20to%20App%20catalog%0A%24App%20%3D%20Add-PnPApp%20-Path%20%24AppFilePath%0A%20%0A%23Deploy%20App%20to%20the%20Tenant%0APublish-PnPApp%20-Identity%20%24App.ID%20-Scope%20Site%20%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3E%26nbsp%3BI%20get%20Error%20below%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3EAdd-PnPApp%20%3A%20Cannot%20contact%20site%20at%20the%20specified%20URL%20%3CA%20href%3D%22https%3A%2F%2Fxxx.sharepoint.com%2Fsites%2FDev%2FAppCatlog%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttps%3A%2F%2Fxxx.sharepoint.com%2Fsites%2FDev%2FAppCatlog%3C%2FA%3E.%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3EThere%20is%20no%20Web%20named%20%22%2Fsites%2FDev%2FAppCatlog%2F_vti_bin%2Fsites.asmx%22.%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3EAt%20C%3A%5CAddPackage.ps1%3A9%20char%3A8%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3E%2B%20%24App%20%3D%20Add-PnPApp%20-Path%20%24AppFilePath%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3E%2B%20CategoryInfo%20%3A%20WriteError%3A%20(%3A)%20%5BAdd-PnPApp%5D%2C%20ClientRequestException%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3E%2B%20FullyQualifiedErrorId%20%3A%20EXCEPTION%2CSharePointPnP.PowerShell.Commands.Apps.AddApp%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3EPublish-PnPApp%20%3A%20Cannot%20bind%20argument%20to%20parameter%20'Identity'%20because%20it%20is%20null.%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3EAt%20C%3A%5C%5CAddPackage.ps1%3A12%20char%3A26%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3E%2B%20Publish-PnPApp%20-Identity%20%24App.ID%20-Scope%20Site%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3E%2B%20~~~~~~~%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3E%2B%20CategoryInfo%20%3A%20InvalidData%3A%20(%3A)%20%5BPublish-PnPApp%5D%2C%20ParameterBindingValidationException%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3E%2B%20FullyQualifiedErrorId%20%3A%20ParameterArgumentValidationErrorNullNotAllowed%2CSharePointPnP.PowerShell.Commands.App%3C%2FFONT%3E%3CBR%20%2F%3E%3CFONT%20color%3D%22%23FF0000%22%3Es.PublishApp%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2117278%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAdmin%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Edeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2118707%22%20slang%3D%22en-US%22%3ERe%3A%20Error%20when%20using%20trying%20to%20publish%2Fdeploy%20spfx%20package%20to%20Apps%20catalog%20in%20a%20site%20collection%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2118707%22%20slang%3D%22en-US%22%3EThanks%20Juan.%3CBR%20%2F%3EGood%20point%20.%20Will%20confirm%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2117353%22%20slang%3D%22en-US%22%3ERe%3A%20Error%20when%20using%20trying%20to%20publish%2Fdeploy%20spfx%20package%20to%20Apps%20catalog%20in%20a%20site%20collection%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2117353%22%20slang%3D%22en-US%22%3EDo%20you%20have%20access%20to%20the%20Global%20App%20Catalogue%20as%20Admin%3F%20If%20no%2C%20that's%20the%20cause%20of%20your%20access%20denied%20error%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2117332%22%20slang%3D%22en-US%22%3ERe%3A%20Error%20when%20using%20trying%20to%20publish%2Fdeploy%20spfx%20package%20to%20Apps%20catalog%20in%20a%20site%20collection%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2117332%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F139606%22%20target%3D%22_blank%22%3E%40Don%20Kirkham%3C%2FA%3E%26nbsp%3Bthanks%20for%20the%20response%3CBR%20%2F%3EYes%20i%20am%20a%20site%20collection%20admin%3CBR%20%2F%3ECorrect%20as%20you%20can%20see%20in%20my%20script%20the%20%3CSPAN%3E%26nbsp%3Bsecond%20option%20had%20%3CSTRONG%3EConnect-PnPOnline%3C%2FSTRONG%3E%20had%20the%20AppCatalog%20off%20the%20url%20but%20still%20getting%20the%20error%20here.%3CBR%20%2F%3EThe%20error%20is%20on%20the%20line%20-%20%22%2B%20%24App%20%3D%20Add-PnPApp%20-Path%20%24AppFilePath%22%20below%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23FF00FF%22%3E%3CSPAN%3EAdd-PnPApp%20%3A%20%7B%22error%22%3A%7B%22code%22%3A%22-2147024891%2C%3CBR%20%2F%3ESystem.UnauthorizedAccessException%22%2C%22message%22%3A%7B%22lang%22%3A%22en-US%22%2C%22value%22%3A%22Access%20denied.%20You%20do%20not%20have%20permission%20to%3CBR%20%2F%3Eperform%20this%20action%20or%20access%20this%20resource.%22%7D%7D%7D%3CBR%20%2F%3EAt%20C%3A%5C%5CAddPackage.ps1%3A9%20char%3A8%3CBR%20%2F%3E%2B%20%24App%20%3D%20Add-PnPApp%20-Path%20%24AppFilePath%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23000000%22%3E%3CSPAN%3EAny%20thoughts%3F%3C%2FSPAN%3E%3C%2FFONT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2117295%22%20slang%3D%22en-US%22%3ERe%3A%20Error%20when%20using%20trying%20to%20publish%2Fdeploy%20spfx%20package%20to%20Apps%20catalog%20in%20a%20site%20collection%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2117295%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F89836%22%20target%3D%22_blank%22%3E%40Patrick%20Rote%3C%2FA%3E%26nbsp%3BAre%20you%20a%20Site%20Collection%20Admin%3F%26nbsp%3B%20Also%2C%20try%20leaving%20the%20%22AppCatalog%22%20off%20the%20url%20in%20the%20Connect-PnPOnline%20command%20script.%20If%20the%20site%20app%20catalog%20was%20created%20via%20PowerShell%20or%20by%20adding%20it%20in%20the%20UI%20with%20the%20App%20Catalog%20template%2C%20the%20Site%20Collection%20knows%20where%20to%20deploy.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2137959%22%20slang%3D%22en-US%22%3ERe%3A%20Error%20when%20using%20trying%20to%20publish%2Fdeploy%20spfx%20package%20to%20Apps%20catalog%20in%20a%20site%20collection%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2137959%22%20slang%3D%22en-US%22%3ESpot%20on%20and%20thats%20was%20the%20issue%3C%2FLINGO-BODY%3E
Contributor

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

5 Replies

@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.

 

@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" 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

 

Any thoughts?

Best Response confirmed by Patrick Rote (Contributor)
Solution
Do you have access to the Global App Catalogue as Admin? If no, that's the cause of your access denied error