CLI for Microsoft 365 is an open-source project driven by the Microsoft 365 Patterns and Practices initiative. With the CLI for Microsoft 365, you can configure your tenant no matter which operating system you use. The CLI for Microsoft 365 is an OS-agnostic alternative of the Microsoft 365 Powershell modules. Additionally, using CLI for Microsoft 365, you can manage your SharePoint Framework projects. This how-to articles shows how to install and manage CLI for Microsoft 365 latest version.
Firstly it is recommended to install a Node version manager like nvm, which will allow you to install Node.js and npm. nvm is a version manager for node.js, designed to be installed per-user, and invoked per-shell.
nvm works on any POSIX-compliant shell (sh, dash, ksh, zsh, bash), in particular on these platforms: unix, macOS, and windows WSL. NVM-Windows is available for Windows installations from: https://github.com/coreybutler/nvm-windows. The procedure provided in this article is meant for Windows endpoints. A very similar installation procedure can be followed in Linux endpoints.
Follow the procedure below:
- Download the Windows installer of nvm-windows from https://github.com/coreybutler/nvm-windows/releases/download/1.1.9/nvm-setup.zip. Or check the github page for a more recent installer version: https://github.com/coreybutler/nvm-windows.
Extract the zip file and run setup.exe.
nvm install v17.0.4 Now open an elevated command line and run the below command: nvm use 17.4.0 Now install the CLI for Microsoft 365 by running following command inside the elevated command prompt: npm i -g @pnp/cli-microsoft365
You can now start running m365 commands in the CLI First run command below to get some documentation on available commands:
For example the current version and status of the M365 module can be seen as per below.
Consult the following resource for more information: https://pnp.github.io/cli-microsoft365/.