
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@pnp/cli-microsoft365
Advanced tools
Manage Microsoft 365 and SharePoint Framework projects on any platform
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
  
Follow our Bluesky, or X account to keep yourself updated about new features, improvements, and bug fixes.
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
npm install -g @pnp/cli-microsoft365@next
yarn global add @pnp/cli-microsoft365
npx @pnp/cli-microsoft365
docker run --rm -it m365pnp/cli-microsoft365:latest
Checkout our guide to learn more about how to run CLI for Microsoft 365 using Docker
Before logging in, you should create a custom Microsoft Entra application registration. Use the
m365 setupcommand 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.
To build and run this CLI locally, you will need node >= 22.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.
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.
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.
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.
FAQs
Manage Microsoft 365 and SharePoint Framework projects on any platform
The npm package @pnp/cli-microsoft365 receives a total of 5,665 weekly downloads. As such, @pnp/cli-microsoft365 popularity was classified as popular.
We found that @pnp/cli-microsoft365 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.ย It has 9 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.