Manage SharePoint Online Site Collection App Catalogs with the CLI for Microsoft 365

In this webinar, hear MVP's Andrew Connell and MVP Waldek Mastykarz for a discussion and demonstration heavy webinar on the CLI for Microsoft 365.

By Last Updated: June 24, 2024 4 minutes read

Microsoft gives us a few options for managing our SharePoint Online environments. We can use the SharePoint Admin center, REST APIs, the CSOM and the SharePoint Online PowerShell. To fill the gaps, the SharePoint PnP group has created PowerShell cmdlets that cover additional tasks not covered by the Microsoft provided PowerShell. While these are good options, they aren’t very friendly to those who aren’t on the Windows platform. These two PowerShell options don’t leverage the cross-platform PowerShell, rather they are only available for the Windows platform.

Introducing the CLI for Microsoft 365

Important: Office 365 CLI renamed
The CLI for Microsoft 365 was formeraly knwon as the Office 365 CLI.

Late last year, fellow MVP Waldek Mastykarz & I started working on an effort to solve this with the CLI for Microsoft 365. This is natively cross-platform command line interface, similar to the Azure CLI, you can install this on any platform (Windows, MacOS or Linux) and manage your Office 365 investments from the command line. When it was initially introduced, many thought it was a Microsoft provided option, when in reality its 100% community driven and run through the SharePoint PnP group. Waldek gets most of the credit here… he did all the work of standing up the project and acts as the project manager addressing community contributions, pull requests, and publishing new versions.

Info: Webinar - February 13, 2018: Introducing and Using the CLI for Microsoft 365 with MVP Waldek Mastykarz

Office 365 & SharePoint Online provide multiple management options. From the tenant to site level, developers and administrators can leverage browser-based administrative interfaces to perform many tasks. However, some tasks can only be implemented via an API or the command line.

The CLI for Microsoft 365, a cross-platform and community-driven project from the SharePoint PnP team, expands these command line tasks beyond the Windows platform and existing PowerShell options.

In this webinar, join MVP and long-time SharePoint developer Andrew Connell (AC) from Voitanos with MVP Waldek Mastykarz from Rencore for a 30-minute discussion and demonstration heavy webinar on the CLI for Microsoft 365.

At the present time the CLI for Microsoft 365 has commands for managing your SharePoint related Microsoft Entra ID tasks and many SharePoint Online tasks. While it’s still under development, the community is working hard to and more and more features with the goal of having 100% parity with the Microsoft provided SharePoint Online PowerShell module & PnP PowerShell module.

In this post I want to highlight on one capability I recently contributed to the CLI for Microsoft 365: managing site collection app catalogs .

Manage SharePoint Site Collection App Catalogs with the CLI for Microsoft 365

Late in 2017, Microsoft introduced a new capability in SharePoint Online: Site Collection App Catalogs! This allows you to deploy a customization that is only installable and thus usable within the site collection and not in other site collections in the tenant.

The site collection app catalogs aren’t created by default in your site collections, nor can you create them in the browser-based interface. Microsoft has provided cmdlets in the SharePoint Online PowerShell module for creating & removing app catalogs from site collections.

If you’re not on Windows (because the SharePoint Online PowerShell only works on Windows), or if you prefer a CLI approach over PowerShell, you can now use the CLI for Microsoft 365 to perform these tasks with two commands I recently contributed to the project.

Add Site Collection App Catalogs

You’ll first need to make sure the CLI for Microsoft 365 is installed on your machine. Verify this by running office365 from the command line. If you get an error, follow the steps here to get it installed.

Once you start the CLI for Microsoft 365, again by running office365 from the command line, you need to connect to your SharePoint Online tenant:

m365 connect

Then, to enable the site collection app catalog, use the spo site appcatalog add command:

m365 spo site appcatalog add --url

This process is fairly immediate so if you go back to your SharePoint Online site, navigate to the Site Contents library, you should see your app catalog!

Removing Site Collection App Catalogs

The CLI for Microsoft 365 also supports removing the app catalog… but you aren’t really removing anything. The naming is a bit misleading.

When you remove the app catalog, you are really just disabling it, telling SharePoint to no longer treat the app catalog as an app catalog. Behind the scenes, SharePoint just treats the library like a normal SharePoint document library.

Again, it’s pretty simple using the spo site appcatalog remove command:

m365 spo site appcatalog remove --url

That’s it!