Tip on adding a Site Collection as an App Catalog
Tags: sharepoint, powershell, office365, automation
Published: 2021-09-28 06:56:17

For all those who work with [_SharePoint Online_][SPO] and use [_PowerShell_][PS], I think this article may be of interest to you.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6wkz3azchl08oogggmxv.jpg)

If you are working on a project in which you have to automate the deployments of the different containers and elements of which it is composed, I will tell you that you are in a good line, from my point of view.

If you are also automating the upload of solutions to the app catalog, then you are taking automation to a new level. And, at this point, this is where this article comes in. Perhaps you know of the existence of the _SharePoint Online_ app catalog where solutions with new functionalities can be deployed globally to the tenant. However, there is also the possibility of creating app catalogs in each of the site collections and, thus, improving the governance of the solutions to be deployed.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nh09vwna9p3l3r9a8h9h.png)

> _A comparison between both models can be found in this article with a very complete list of pros and cons, [https://chuvash.eu/2019/12/11/site-collection-app-catalog-vs-tenant-app-catalog](https://chuvash.eu/2019/12/11/site-collection-app-catalog-vs-tenant-app-catalog)_

> _On the other hand, the official Microsoft information about this can be found at the following link, [https://docs.microsoft.com/en-us/sharepoint/dev/general-development/site-collection-app-catalog](https://docs.microsoft.com/en-us/sharepoint/dev/general-development/site-collection-app-catalog)_

But my article is not about whether to use one or the other since it is none of our business. What I want to do is help you not to waste your time as I have done configuring a site collection as an app catalog using _PowerShell_ commands.

If you use the standard _SharePoint Online_ commands, [_https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/add-spositecollectionappcatalog?view=sharepoint-ps_](https://docs.microsoft.com/en-us/powershell/module/sharepoint-online/add-spositecollectionappcatalog?view=sharepoint-ps), it is very easy to apply it, just invoke the command and pass the site collection or its URL, the nuance is not important.

If you use the _PnP_ commands, [_https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/add-pnpsitecollectionappcatalog?view=sharepoint-ps_](https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/add-pnpsitecollectionappcatalog?view=sharepoint-ps), it continues indicating the same and using the same parameters.

The truth is that it does not matter if you use one set of commands or another, the result will be the same. The important thing is where you invoke the command from, and by place, I mean the site collection that you are going to connect to in the first place to invoke that command. If you use a connection to the site collection where you are creating all those lists, libraries, etc., and you want to activate it as an application catalog, it will give you a forbidden error, specifically, 403.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0bfeu6mcm1s7yioshiyk.png)

The only way to do that is if you are connected to the SharePoint administration site collection, the famous _"https://#tenant-name#-admin.sharepoint.com"_. If not, you will not be able to activate it in any site collection.

Keep this in mind whenever you do any operation of this type and take a good look at the connection you are using, it will be very important to know where you are executing the _PowerShell_ commands.

I hope it has been useful.

[SPO]: https://www.microsoft.com/en-us/microsoft-365/sharepoint/collaboration
[PS]: https://docs.microsoft.com/en-us/powershell/scripting/overview?view=powershell-7.1