RepositoryTypeScript
pnp

pnp/cli-microsoft365

Manage Microsoft 365 and SharePoint Framework projects on any platform

1.5kstars
423forks
171issues
6views

Featured achievements

The project's latest awards

1
TINIX TRENDING·Topic: sharepoint-framework

#1 Repository of the week

1
TINIX TRENDING·Topic: spfx

#1 Repository of the week

1
TINIX TRENDING·Topic: sharepoint-online

#1 Repository of the week

CLI for Microsoft 365
CLI for Microsoft 365

One CLI for Microsoft 365

Discord Bluesky X

GitHub npm @pnp/cli-microsoft365@latest npm @pnp/cli-microsoft365@next

CLI for Microsoft 365 helps you manage your Microsoft 365 tenant and SharePoint Framework projects.

Website | Features | Install | Usage | Build | Contribute

Code of Conduct | Need help? | Disclaimer

Microsoft 365 & Power Platform Community

CLI for Microsoft 365

Features

  • Run on any OS
    • Linux
    • MacOS
    • Windows
  • Run on any shell
    • Azure Cloud Shell
    • bash
    • cmder
    • PowerShell
    • zsh
  • Unified login
    • Access all your Microsoft 365 workloads
  • Supported workloads
    • Bookings
    • Microsoft Entra ID
    • Microsoft Teams
    • Microsoft To Do
    • Microsoft Viva
    • OneDrive
    • OneNote
    • Outlook
    • Planner
    • Power Automate
    • Power Apps
    • Power Platform
    • Purview
    • SharePoint Embedded
    • SharePoint Online
    • SharePoint Premium
    • To Do
  • Supported authentication methods
    • Azure Managed Identity
    • Certificate
    • Client Secret
    • Device Code
    • Federated identity
    • Username and Password
  • Manage your SharePoint Framework projects
    • Upgrade your projects
    • Check your environment compatibility

Follow our Bluesky, or X account to keep yourself updated about new features, improvements, and bug fixes.

Install

To use the CLI for Microsoft 365 you need Node.js. The CLI has been tested with Node.js versions 20 and higher, but we recommend you to use the Node.js LTS version available at the moment.

npm install -g @pnp/cli-microsoft365
Install beta version β
npm install -g @pnp/cli-microsoft365@next
Alternate package managers 🧶

yarn

yarn global add @pnp/cli-microsoft365

npx

npx @pnp/cli-microsoft365
Run CLI for Microsoft 365 in a Docker container 🐳
docker run --rm -it m365pnp/cli-microsoft365:latest

Checkout our guide to learn more about how to run CLI for Microsoft 365 using Docker

Usage

Before logging in, you should create a custom Microsoft Entra application registration. Use the m365 setup command or refer to the Using your own Microsoft Entra identity guide.

Use the login command to start the Device Code login flow to authenticate with your Microsoft 365 tenant.

m365 login

For alternative authentication methods and usage, refer to the login command documentation

List all commands using the global --help option.

m365 --help

Get command information and example usage using the global --help option.

m365 spo site get --help

Execute a command and output response as JSON.

m365 spo site get --url https://contoso.sharepoint.com

Filter responses and return custom objects using JMESPath queries using the global --query option.

m365 spo site list --query '[?Template==`GROUP#0`].{Title:Title, Url:Url}'

Execute a command and output response as text using the global --output option.

m365 spo site get --url https://contoso.sharepoint.com --output text

For more examples and usage, refer to the command and sample scripts documentation.

Build

To build and run this CLI locally, you will need node >= 24.0.0 installed.

# Clone this repository
$ git clone https://github.com/pnp/cli-microsoft365

# Go into the repository
$ cd cli-microsoft365

# Install dependencies
$ npm install

# Build the CLI
$ npm run build

# Symlink your local CLI build
$ npm link

When you execute any m365 command from the terminal, it will now use your local clone of the CLI.

Contribute

We love to accept contributions.

If you want to get involved with helping us grow the CLI, whether that is suggesting or adding a new command, extending an existing command, or updating our documentation, we would love to hear from you.

Check out our Contributing Guide for detailed information on how to contribute to this project.

Need Help?

Join our community

Discord

Microsoft 365 & Power Platform Community

CLI for Microsoft 365 is a Microsoft 365 & Power Platform Community (PnP) project. Microsoft 365 & Power Platform Community is a virtual team consisting of Microsoft employees and community members focused on helping the community make the best use of Microsoft products. CLI for Microsoft 365 is an open-source project not affiliated with Microsoft and not covered by Microsoft support. If you experience any issues using the CLI, please submit an issue in the issues list.

Disclaimer

THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.

telemetry

Similar Projects

Discover other similar projects and AI models.

RepositoryDockerfile
pnp/docker-spfx

Docker images for working with SharePoint Framework

134
Nov 20, 2026
RepositoryTypeScript
OlivierCC/sp-client-custom-fields

Web Site: https://oliviercc.github.io/sp-client-custom-fields

112
Aug 18, 2021
RepositoryPython
vgrem/office365-rest-python-client

Microsoft 365 & Microsoft Graph Library for Python

1.7k
Dec 1, 2026
RepositoryXSLT
microsoftgraph/msgraph-metadata

Microsoft Graph metadata captured and used for generating client library code files.

171
Dec 1, 2026
RepositoryTypeScript
microsoftgraph/microsoft-graph-toolkit

Authentication Providers and UI components for Microsoft Graph 🦒

1.1k
Aug 28, 2026
RepositoryTypeScript
koltyakov/sp-rest-proxy

🌐 SharePoint API Proxy for local development

176
Oct 18, 2026
RepositoryTypeScript
pnp/vscode-viva

With the SharePoint Framework Toolkit extension, you can create and manage your SharePoint Framework solutions on your tenant. All actions you need to perform during the development flow are at your fingertips.

80
Nov 29, 2026
RepositoryPowerShell
SharePoint/sp-dev-docs

SharePoint Developer Documentation

1.4k
Nov 24, 2026
RepositoryC#
pnp/powershell

PnP PowerShell

921
Nov 29, 2026