I am using below PnP PowerShell command to add site collection level application catalog and giving me an Unauthorized error. I currently have owner access to the site.
PowerShell
$siteUrl = "https://site/"
Connect-PnPOnline $siteUrl
$site = Get-PnPSite
Add-PnPSiteCollectionAppCatalog -Site $site
ERROR
Add-PnPSiteCollectionAppCatalog : The remote server returned an error: (401) Unauthorized. At line:6 char:1 + Add-PnPSiteCollectionAppCatalog -Site $site + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : WriteError: (:) [Add-PnPSiteCollectionAppCatalog], WebException + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Admin.AddSiteCollectionAppCatalog
Does 'Add-PnPSiteCollectionAppCatalog' command require more access or is this access enough for this command.
EDIT
Because I was getting this error I tried the same on Developer Tanet where I am an admin on the tenant which give me below error.
Add-PnPSiteCollectionAppCatalog : Cannot invoke method or retrieve property from null object. Object returned by the following call stack is null. "TenantAppCatalog RootWeb GetSiteByUrl new Microsoft.Online.SharePoint.TenantAdministration.Tenant() " At C:\Ravi\SPO\PowerShell\Add-SiteCollectionLevelAppCatalog.ps1:8 char:1 + Add-PnPSiteCollectionAppCatalog -Site $site + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : WriteError: (:) [Add-PnPSiteCollectionAppCatalog], ServerException + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Admin.AddSiteCollectionAppCatalog