CLI for Microsoft 365 v5.1

Published Mar 31 2022 01:50 AM 1,845 Views
New Contributor

Manage Microsoft 365 and SharePoint Framework projects on any platform

CLI for Microsoft 365 is a cross-platform CLI that allows you to manage various configuration settings of Microsoft 365 and SharePoint Framework projects no matter which operating system or shell you use.

 

While building solutions for Microsoft 365 expands beyond the Windows operating system, managing many of the platform settings is possible only through PowerShell on Windows. As more and more users work on non-Windows machines, it’s inconvenient for them to have to use a Windows virtual machine to configure their tenants. With the CLI for Microsoft 365, you can configure your tenant no matter which operating system you use. Additionally, using CLI for Microsoft 365, you can manage your SharePoint Framework projects.

 

The new version of CLI for Microsoft 365 – v5.1

Following our monthly release cadence, we’ve released a new version of the CLI for Microsoft 365 with some new capabilities. Here are a few of the most noteworthy additions.

 

For the full list of what's new and changed, see the release notes.

Validate correctness of a SharePoint Framework project

When building Microsoft 365 apps using the SharePoint Framework, it could happen that you hit a snag. To help you self-diagnose your project, we've worked with the SharePoint Framework engineering team, to provide you a command that validates the configuration of your project. If there are any issue, you'll get a report with additional explanation and a script that you can run to fix these issues!

 

To validate your SharePoint Framework project, change the working directory to your project and execute:

 

m365 spfx project doctor --output md > "doctor-report.md"

 

The command will analyze your project and store the list of findings in a file named doctor-report.md. For more information about validating SharePoint Framework projects, see the documentation.

 

Register management application for Power Platform

More and more organizations are using Power Platform to automate business processes and build line of business applications. Using Power Platform APIs, they can automate managing these solutions. To use these APIs, you need to register your app as a management application with Power Platform.

 

If you wanted for example to use CLI for Microsoft 365 as a Power Platform management app, execute the following command:

 

m365 pp managementapp add --appId 31359c7f-bd7e-475c-86db-fdb8c937548e

 

For more information about working with Power Platform using CLI for Microsoft 365, see the documentation.

 

Configure Microsoft 365 groups' behavior

You might want to specify the behavior of your Microsoft 365 Groups during provisioning. You can set specific group behaviors and resources to provision when creating a Microsoft 365 group.

 

AllowOnlyMembersToPost Only group members can post conversations to the group.
HideGroupInOutlook This group is hidden in Outlook experiences.
SubscribeNewGroupMembers Group members are subscribed to receive group conversations.
WelcomeEmailDisabled Welcome emails are not sent to new members.

 

For example, to create a public Microsoft 365 group and set it to not send welcome emails to new group members, execute:

 

m365 aad o365group add --displayName Finance --description "This is the Contoso Finance Group. Please come here and check out the latest news, posts, files, and more." --mailNickname finance --welcomeEmailDisabled

 

To create a public Microsoft 365 group and hide it from the Outlook experiences (web and client), execute:

 

m365 aad o365group add --displayName Finance --description "This is the Contoso Finance Group. Please come here and check out the latest news, posts, files, and more." --mailNickname finance --hideGroupInOutlook

 

For more information about creating Microsoft 365 groups, see the CLI documentation.

 

Interacting with Microsoft 365 conversations becomes easier

In CLI for Microsoft 365 v5.0 we introduced commands to create Microsoft 365 group conversations. This release finalized the set of commands required to interact with conversations with the command m365 aad o365group conversation post list.

 

For more information about retrieving Microsoft 365 Group conversations, see the CLI documentation.

 

New script samples

CLI for Microsoft 365 is a great tool both for quick adjustments to the configuration of your Microsoft 365 tenant as well as for automating more complex tasks. Because CLI for Microsoft 365 is cross-platform you can use it on any OS and in any shell. To help you get started using the CLI for Microsoft 365 for automation scenarios, we started gathering some sample scripts.

 

If you have any scripts that you use frequently, please share them with us so that we can learn more about your common automation scenarios.

 

Migrate planner plan to SharePoint Online

Albert-Jan Schot contributed a sample that shows how to migrate a Planner Plan to a SharePoint list.

 

Change group membership of all SharePoint Online sites

Another sample script that Arjun Menon published is how to downgrade the permissions of all members of an owner group to the default member group.

 

Contributors

This release wouldn't be possible without the help of (in alphabetical order):

Thank you all for the time you chose to spend on CLI for Microsoft 365 and for your help to advance it!

 

Work in progress

Here are some things that we're currently working on.

 

@me user tokens to simplify working with the current user

We're constantly seeking for ways to let you work with CLI for Microsoft 365 more efficiently. In the past, we've shipped support for passing contents from files into options using the @ token and using server-relative URLs with SharePoint commands. We're continuing the improvement by introducing @me tokens to let you pass information about the current user into options.

 

Microsoft 365 app commands

When building apps for Microsoft 365, next to your code, you also need to manage how your app is exposed to Microsoft 365. You need to register your application in Azure Active Directory, and depending what type of app you build, you might need to deploy it to an app catalog as well. All these properties are managed in different locations and we're thinking of ways that we could simplify it for you.

 

OneNote commands

We are extending our commands with OneNote capabilities. We will start by giving you the ability to provision and retrieve OneNote notebooks.

 

Interact with the Microsoft Search schema

We are not going to stop with OneNote commands but we will also extend our command palette in the Microsoft Search ecosystem. We are going to implement a command that will allow you to add a schema to a specific external connection for use in Microsoft Search.

 

What else could we simplify? Let us know what you think by helping out with one of our open issues or chime in on our discussions!

 

Try it today

Get the latest release of CLI for Microsoft 365 from npm by executing:

 

npm i -g @pnp/cli-microsoft365

 

Alternatively, you can get the latest release from Docker by executing:

 

docker run --rm -it m365pnp/cli-microsoft365:latest

 

If you need more help getting started or want more details about the commands or the architecture or the project, go to aka.ms/cli-m365. And if you see any room for improvement, please, don't hesitate to reach out to us either on GitHub or Twitter.

Co-Authors
Version history
Last update:
‎Mar 31 2022 01:52 AM
Updated by:
We support Ukraine and condemn war. Push Russian government to act against war. Be brave, vocal and show your support to Ukraine. Follow the latest news HERE