Office 365 CLI¶
Using the Office 365 CLI, you can manage your Microsoft Office 365 tenant on any platform. No matter if you are on Windows, macOS or Linux, using Bash, Cmder or PowerShell, using the Office 365 CLI you can configure Office 365 and build automation scripts.
The Office 365 CLI is distributed as an NPM package. To use it, install it globally using:
npm i -g @pnp/office365-cli
or using yarn:
yarn global add @pnp/office365-cli
Start the Office 365 CLI by typing in the command line:
$ office365 o365$ _
office365 command will start the immersive CLI with its own command prompt.
Start managing the settings of your Office 365 tenant by connecting to it, using the
spo connect <url> site, for example:
o365$ spo connect https://contoso-admin.sharepoint.com
Depending on which settings you want to manage you might need to connect either to your tenant admin site (URL with
-adminin it), or to a regular SharePoint site. For more information refer to the help of the command you want to use.
To list all available commands, type in the Office 365 CLI prompt
To exit the CLI, type
See the User Guide to learn more about the Office 365 CLI and its capabilities.
SharePoint Patterns and Practices¶
Office 365 CLI is an open-source project driven by the SharePoint Patterns and Practices initiative. The project is built and managed publicly on GitHub at https://github.com/SharePoint/office365-cli and accepts community contributions. We would encourage you to try it and tell us what you think. We would also love your help! We have a number of feature requests that are a good starting point to contribute to the project.
“Sharing is caring”
SharePoint PnP team