Skip to content
Skip to content
Menu
A cup of dev
  • Home
  • About
  • Ink and yarn
  • Contact
A cup of dev

My top 5 uses for Microsoft 365 CLI

By Eli H. Schei on Monday, 1 August 2022, 7:37Friday, 1 July 2022, 7:42

There are a lot of useful things you can do with the Microsoft 365 CLI, and choosing 5 things was hard. These are the things I use the most – but depending on your specific tasks there might be other commands that are more useful for you – so I recomend to also take a look at all the M365 CLI has to offer.

Prerequesites: If you have not allready, first you need to install the Microsoft 365 CLI. npm install -g @pnp/cli-microsoft365

1. Manage your app registrations

Almost every Microsoft 365 app you are building needs an Azure AD app registration, and with the M365 CLI you can easeli manage those registrations. Waldek Mastyrkarz have a great blogpost that covers this in more details.

// Register new app - see documentation (linked below) for more options
m365 aad app add --name 'My app name'

// Get app registration by appid
m365 aad app get --appId <app GUID goes here>

Documentation for M365 CLI Azure AD app registrations

2. Get a report on how to upgrade your SPfx solution

I also mentioned this in my latest blogpost about upgrading SPfx solutions, but its so useful it should be mentioned again. This command will generate a report that tells you how to update your SPfx solution step by step.

m365 spfx project upgrade --toVersion 1.14.0 --output md > "upgrade-report.md"

Documentation for package upgrade

3. Add app to SPO app catalog

One of my first blogposts covers how to deploy your SPfx packages with PnP powershell. And you could still do it like described there, but recently I’ve been using the M356 CLI for this too.

m365 spo app add --filePath ../yourPathHere/spfx-app-package.sppkg

Documentation for add app

4. SPFx doctor

The SPfx doctor is very useful if you ever have to take over an app from someone else, or if you are on a new/different computer, then you can use the spfx doctor command to see if your environment meets the prerequesites for the version of SPfx used.

m365 spfx doctor

Documentation for spfx doctor

5. Managing apps in Teams

If you are developing apps for Teams the M365 CLI offers some great tools to manage these apps.

Get list of all apps in a team

// From your organizations app catalog. Add parameter --all to see all apps (not only from org)
m365 teams app list

// See apps in specific team
m365 teams app list --teamId <Your team GUID here>

Install or uninstall app

// Install
m365 teams app install --appId <your app-id here>

// Uninstall
m365 teams app uninstall --appId <your app-id here>

You can also publish an app or remove an app with M365 CLI.


Did you find this article usefull? Follow me on twitter to be notified when I publish something new!

If you are interested in Microsoft 365 Development you might also like my other blogposts in this category.

Also, if you have any feedback or questions, please let me know in the comments below. šŸ™‚

Thank you for reading, and happy coding!

/Eli

Share this:

  • Twitter
  • Facebook

Post navigation

How to upgrade your SPfx project to the latest version, and how to fix/avoid common issues
How to enable source-map in PCF projects – for easier debugging

Leave a Reply Cancel reply

Eli H. Schei

I'm a front-end developer who mainly work in the Microsoft 365-sphere. As a developer I read a lot of blogs. And in my experience I can read multiple different blogposts about exactly the same topic, and only one of them makes sense to me. Therefore I’m adding my voice to the mix, and hopefully one of my blogposts will be the one that makes sense of a topic for you. You can learn more about me here.

Recent Posts

  • 5 tips for nailing your first Microsoft certification exam
  • My top 5 most read blogposts in 2022
  • How to solve the ‘Could not find the task func: host start’ error in VS Code when working with Azure functions
  • Use your coding skills to extend Microsoft Teams
  • How to enable source-map in PCF projects – for easier debugging

Categories

  • Azure
    • Azure functions
  • Level
    • Beginner
    • Intermediate
  • Microsoft 365 Development
    • Microsoft Authentication Library
    • Microsoft Graph
    • Microsoft Teams
    • PNP powershell
    • PowerApps
      • PowerApps Component Framework
    • SharePoint Framework
    • SharePoint Online
  • Web development
    • Accessibility
    • Soft skills
    • Tips and tricks

Tags

accessibility ARIA Azure CLI azure functions Content creation custom themes favorites git github M365 CLI M365 development PCF PnP powershell power apps PowerApps Component Framework quicktip react resources SharePoint Online Sideloading SPfx Teams tools wcag Windows terminal
©2023 A cup of dev | WordPress Theme by SuperbThemes.com