Enable app catalog at site collection level using PowerShell

Enable app catalog at site collection level using PowerShell

Enable app catalog at site collection level using PowerShell. 

In SharePoint Online we can deploy apps, SPX solutions based on our requirement to appcatalog at site collection, once we deployed at app catalog site collection solution will be available for all site collections and developers need to contact admins to deploys apps multiple times this will impact on project deliverable’s. 
To avoid this, we can enable app catalog at site collection level itself using PowerShell. 
To deploy apps at site collection level we need to enable app catalog at site collection level using PowerShell, for enabling we should require Tenant admin access (For me it is working fine with SharePoint Admin access) and to deploy apps required site collection admin access. 


To enable App catalog for multiple site collections based on our Input file. Create a CSV file  as per the below format . 

SiteURL 

https://dotnetsharepoint.sharepoint.com/sites/Site1 
https://dotnetsharepoint.sharepoint.com/sites/Site2 
https://dotnetsharepoint.sharepoint.com/sites/Site3
 

 Code  

 # SharePoint Admin URl 
$AdminURL = "https://dotnetsharepoint-admin.sharepoint.com" 
 $Cred = Get-Credential 
 #Connect to SharePoint Online 
Connect-SPOService -Url $AdminURL -Credential $Cred 
 #sites from csv 
$sites = Import-Csv -Path "D:\SitesInput.csv" 
 #Get sites one by one 
foreach($row in $sites) 
{ 
     $site = Get-SPOSite -Identity $row.SiteURL 
    $sitecollURL = $site.Url  
     Add-SPOSiteCollectionAppCatalog-Site$sitecollURL 
    Write-Host $sitecollURL 
  }  
 
 
 

Get-SPOSite The managed path sites is not a managed path in this tenant.

Get-SPOSite : The managed path sites is not a managed path in this tenant.

When we are trying to enable scripting at site collection level based on my input file, suddenly we got an error as per the below. Get-SPOSite : The managed path sites is not a managed path in this tenant.


This is very basic issue but just I am sharing my knowledge and findings as an article.

 Solution:

We reviewed the input file for one of the site collections it was added extra slash "/"

Example : https://dotnetsharepoint.sharepoint.com/sites/mytestsite/

Remove the / at the ending, issue will resolve automatically.

Hope this will helps you all.