CLI for Microsoft 365 v4.3
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.
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.
We’ve continued improving the CLI, building upon the changes we introduced in the previous version.
With the announcement of the availability of public preview of the SharePoint Framework (SPFx) 1.14 – with updates for Viva Connections, Microsoft Teams and SharePoint Online experiences, we have added support for upgrading your SPFx projects to the latest preview version, v1.14.0-beta.4. To upgrade your SPFx project to this version, change the working directory to your project and execute:
m365 spfx project upgrade --preview --output md > report.md
We’d also recommend that you try a richer upgrade report based on the Visual Studio Code CodeTour extension:
m365 spfx project upgrade --preview --output tour
For more information about upgrading SharePoint Framework projects, see the CLI documentation.
In this release we have added a new global output mode to return information from Microsoft 365 in CSV format, adding to the JSON and Text output modes that we already have. To retrieve information about a given SharePoint site as CSV output, execute:
m365 spo web get --webUrl https://contoso.sharepoint.com --output csv
An environment is a space to store, manage, and share your organization’s business data, apps, chatbots, and flows. It also serves as a container to separate apps that might have different roles, security requirements, or target audiences. Previously you could only return a list of Power Apps in the default environment, however we have extended the pa app list command so that you can return a list of apps from any environment in your tenant. To retrieve a list of Power Apps in a given environment, execute:
m365 pa app list --environment Default-d87a7535-dd31-4437-bfe1-95340acd55c5
We’ve simplified returning information about a given Azure AD user, by adding support for using their email address as an identifier, adding to ID and UPN which we also support. To retrieve information about a given user by their email address, execute:
m365 aad user get --email AarifS@contoso.onmicrosoft.com
We’ve introduced several commands in this release providing new capabilities across Microsoft 365.
When building apps and integrations against Microsoft 365, the first thing you need to do is authenticate and for that you need to register Azure AD applications to setup that trust and assign permissions accordingly. We’ve added a new command that returns information about given Azure AD app registrations. To retrieve an Azure AD app registration by its name, execute:
m365 aad app get --name "My app"
In Azure Active Directory you can you can define fine-grained password policies that control account lockout settings or minimum password length and complexity. We’ve added a new command that simplifies the ability for you to test and validate example passwords against your organisation’s policy. To validate the password cli365P@ssW0rd against your organisation’s password validation policy, execute:
m365 aad user password validate --password "cli365P@ssW0rd"
Previously we added the ability for you to create an Azure AD app registration and store information about the registration in a file called .m365rc.json, in this release we have added a new command that retrieves the API permissions of the app registration stored locally. To create a new Azure AD app registration with a specified name and store the information locally in a .m365rc.json file, execute:
m365 aad app add --name 'My AAD app' --save
To list the API permissions for the Azure AD app registered in the .m365rc.json file, execute:
m365 app permission list
Microsoft Search indexes all your Microsoft 365 data to make it searchable for users. Using the Microsoft Graph to create new external connections, your organization can index third-party data so it appears in Microsoft Search results, for example, indexing HR data in SQL Server. We’ve added a new command that helps you expand the types of content sources that are searchable in your Microsoft 365 productivity apps and the broader Microsoft ecosystem. To create a new external connection definition for Microsoft Search, execute:
m365 search externalconnection add --id MyApp --name "My application" --description "Description of your application"
Microsoft Planner provides a simple visual way to organise teamwork, we’ve added a new command that provides the ability to create new tasks in a Planner board but also assign those tasks to team members and set due dates. To create a task in a given plan and bucket by their IDs, execute:
m365 planner task add --title "My Planner Task" --planId "8QZEH7b3wkSbGQobscsM5gADCBa" --bucketId "IK8tuFTwQEa5vTonM7ZMRZgAKdna"
To create a completed task in a plan owned by a group, execute:
m365 planner task add --title "My Planner task" --planName "My Planner Plan" --ownerGroupName "My Planner Group" --bucketId "IK8tuFTwQEa5vTonM7ZMRZgAKdna" --percentComplete 100
To create a task assigned to multiple users and set the due date, execute:
m365 planner task add --title "My Planner Task" --planId "8QZEH7b3wkSbGQobscsM5gADCBa" --bucketId "IK8tuFTwQEa5vTonM7ZMRZgAKdna" --assignedToUserNames "Allan.Carroll@contoso.com,Ida.Stevens@contoso.com" --dueDateTime "2021-12-16"
If your organisation spans a diverse population, you may want to make content in your SharePoint sites available in multiple languages. SharePoint Online currently supports 50 different languages and we’ve added a command to return the list of installed languages in a give SharePoint site to help you identify the languages available for use in that site. To retrieve all installed languages from a given site, execute:
m365 spo web installedlanguage list --webUrl https://contoso.sharepoint.com
CLI for Microsoft 365 is a great tool both for quick adjustments to the configuration of your Microsoft 365 tenant as well as 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 the common automation scenarios.
This script helps you to copy SharePoint List Items from a destination SharePoint Online list to another target SharePoint Online list in another Site Collection.