SharePoint Online: How to Create Site Collection App Catalog?

Requirement: Enable site collection app catalog in SharePoint Online.

How to Create Site Collection App Catalog in SharePoint Online?
App catalog in SharePoint Online is a central repository where Apps are installed and accessible to all sites in your Office 365 tenant. Site collection app catalog allows you to configure a Site collection specific App Catalog. Once enabled, site collection administrators can deploy SharePoint Apps/add-ins and SPFx solutions that will be available only in that particular site collection. This means that instances of the App are only available for use on the Site Collections where the Apps are added to their respective Site Collection App Catalogs.  Site collection App catalogs are generally used for the decentralization and scope limiting of SharePoint Apps.

When to use Site Collection App Catalog?
Tenant administrators can enable app catalog on the specific sites in following scenarios.
  1. When you want certain solutions to be available in only specific sites - You can deploy your apps in site collection app catalog to prevent it from available across all sites in the tenant.
  2. You are developing an App and you want to make the app available only within a dev site until its ready. Or if you want to test an app without making it visible for the whole tenant.
  3. You want to have multiple versions of your Add-in / App installed on your tenant.
  4. You want to offload some responsibility or control permissions to access to tenant app catalog - You can delegate the management of your SharePoint Add-in / App to can upload SPFx solutions in their own site collection without bothering the tenant administrator.
sharepoint online site collection app catalog
As you can see, Add in / App or SPFx solutions can be directly uploaded to Tenant App Catalog and will be available across entire tenant site collection or they can be uploaded to specific site collection app catalogs and they will be made available to specific site collection only.

SharePoint Online: Create Site Collection App Catalog using PowerShell
To create SharePoint Online site collection app catalog, we can use this PnP PowerShell script. Run this script as a tenant administrator. Make sure you have "Tenant Admin" rights and Site collection Administrator rights on the "Tenant App Catalog" site before proceeding. Otherwise, you'll face
"Add-PnPSiteCollectionAppCatalog : Must have Manage Web Site permissions or be a tenant admin in order to add or remove sites from the site collection app catalog allow list" Error!

PowerShell to Enable Site Collection App Catalog
Here is the PnP PowerShell to add site collection app catalog in SharePoint Online.
#Parameters
$TenantAdminURL = "https://crescent-admin.sharepoint.com"
$SiteURL = "https://crescent.sharepoint.com/sites/Dev"

#Connect to Tenant Admin
Connect-PnPOnline -Url $TenantAdminURL -Credentials (Get-Credential) 

#Enable site collection app catalog
Add-PnPSiteCollectionAppCatalog -Site $SiteURL
Once you execute this script, you should see the "Apps for SharePoint" in the Site Collection's Site Contents page.
sharepoint online create site collection app catalog
To get all site collection app catalogs in your tenant visit this URL: https://<tenant>.sharepoint.com/sites/<tenant-app-catalog>/Lists/SiteCollectionAppCatalogs/AllItems.aspx

Disable Site Collection App Catalog using PowerShell
Use this PnP PowerShell to remove the site app catalog functionality from your site.
#Parameters
$TenantAdminURL = "https://crescent-admin.sharepoint.com"
$SiteURL = "https://crescent.sharepoint.com/sites/Dev"

#Connect to Tenant Admin
Connect-PnPOnline -Url $TenantAdminURL -Credentials (Get-Credential) 

#disable site collection app catalog
Remove-PnPSiteCollectionAppCatalog -Site $SiteURL

How to Deploy an App to Site Collection App Catalog?
To deploy an App to SharePoint Online site collection app catalog, follow these steps:
  • Navigate to the Site Contents page of the Site Collection you have enabled app catalog.
  • Click on the "Apps for SharePoint" list.
  • When on the Apps for SharePoint library, upload your custom solution .sppkg or .app file using either the Upload button or dragging and dropping the file from your computer to the library.
  • If its a .sppkg, You'll get a prompt asking if you trust the solution and if you would like to "Make this solution available to all sites in the organization". Make sure to check this option and then click Deploy.
We are actually enabling the app to be accessible to all Sub Sites of the Site Collection, not the organization as a whole.

Creating Tenant App catalog and site collection app catalog (using SharePoint Online Management Shell) is explained in my another post: How to Create App Catalog Site in SharePoint Online?

2 comments:

  1. There is a typo in "Disable Site Collection App Catalog using PowerShell". Please update command to Remove-PnPSiteCollectionAppCatalog instead of Add-PnPSiteCollectionAppCatalog

    ReplyDelete

Please Login and comment to get your questions answered!

Powered by Blogger.