{"id":5142,"date":"2020-09-05T05:14:04","date_gmt":"2020-09-05T12:14:04","guid":{"rendered":"https:\/\/officedevblogs.wpengine.com\/?p=5142"},"modified":"2020-09-05T05:14:04","modified_gmt":"2020-09-05T12:14:04","slug":"cli-microsoft-365-3","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/cli-microsoft-365-3\/","title":{"rendered":"CLI for Microsoft 365 v3"},"content":{"rendered":"<p>We have just published a new major version of CLI for Microsoft 365 v3. Here is what has changed.<\/p>\n<h2 id=\"manage-microsoft-365-and-sharepoint-framework-projects-on-any-platform\">Manage Microsoft 365 and SharePoint Framework projects on any platform<\/h2>\n<p>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.<\/p>\n<p>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&#8217;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.<\/p>\n<h2 id=\"new-major-version\">New major version<\/h2>\n<p>As we kept extending CLI for Microsoft 365 with new functionality during the last year, we noticed a few areas that we could improve to simplify using the CLI. As such, this new major version is evolutionary. Following is the overview of the most noteworthy changes introduced in CLI for Microsoft 365 v3. For the full list of changes, see the <a href=\"https:\/\/pnp.github.io\/cli-microsoft365\/about\/release-notes\/#v300\">release notes<\/a>.<\/p>\n<blockquote><p>To help you upgrade to v3, we prepared a summary of breaking changes and the recommended actions. For more information see the <a href=\"https:\/\/pnp.github.io\/cli-microsoft365\/v3-upgrade-guidance\/\">v3 Upgrade Guidance<\/a> in our docs.<\/p><\/blockquote>\n<h3 id=\"new-name-_office-365-cli_-becomes-_cli-for-microsoft-365_\">New name: <em>Office 365 CLI<\/em> becomes <em>CLI for Microsoft 365<\/em><\/h3>\n<p>Earlier this year, Microsoft renamed Office 365 to Microsoft 365 to better address the complete suite of their productivity technology. To stay consistent with the new name, we renamed <em>Office 365 CLI<\/em> to <em>CLI for Microsoft 365<\/em>. We hope that the new name clearly illustrates our ambition to offer you one CLI to manage all of your Microsoft 365 tenant and its services.<\/p>\n<p>To start the CLI, in the past you&#8217;d execute in the command line <code>office365<\/code> or <code>o365<\/code> for short. In the latest version 2 we&#8217;ve already introduced the new executable names <code>microsoft365<\/code> or <code>m365<\/code>. Starting from v3, the <code>office365<\/code> and <code>o365<\/code> executables are no longer available and you can execute CLI for Microsoft 365 commands only using <code>microsoft365<\/code> or <code>m365<\/code>.<\/p>\n<p>Starting from version 3, CLI for Microsoft 365 is available on npm at <code>@pnp\/cli-microsoft365<\/code>. Version 2 of the CLI available at <code>@pnp\/office365-cli<\/code> will remain available on npm, but will be deprecated. We won&#8217;t be updating it anymore and recommend that you upgrade to version 3 to benefit of the latest additions and improvements.<\/p>\n<p>We also renamed our GitHub repo which is now available at <a href=\"https:\/\/github.com\/pnp\/cli-microsoft365\">https:\/\/github.com\/pnp\/cli-microsoft365<\/a>. Our docs are published at <a href=\"https:\/\/pnp.github.io\/cli-microsoft365\">https:\/\/pnp.github.io\/cli-microsoft365<\/a> or <a href=\"https:\/\/aka.ms\/cli-m365\">https:\/\/aka.ms\/cli-m365<\/a> for short.<\/p>\n<h3 id=\"removed-immersive-mode\">Removed immersive mode<\/h3>\n<p>In the past you could use CLI for Microsoft 365 in two ways. You could either execute a specific command, like <code>o365 spo site list<\/code> or you could start the CLI in immersive mode by running <code>o365<\/code> and get a CLI-specific command prompt.<\/p>\n<p>In the past year we found out that the immersive mode isn&#8217;t used as much as we initially had thought it would be. While it gives instant access to command completion, it prevents you from using other shell commands. What&#8217;s more, immersive mode depends on Vorpal which the community stopped maintaining.<\/p>\n<p>Thinking about the future, we decided to remove immersive mode and start preparing for removing Vorpal. This will allow us to keep all our dependencies up-to-date.<\/p>\n<h3 id=\"removed-obsolete-aliases-and-options\">Removed obsolete aliases and options<\/h3>\n<p>Despite our best efforts to review specs for all commands that we implement in CLI for Microsoft, over the course we picked up some inconsistencies. While we adjusted them as quickly as possible to offer you a consistent experience across all commands, we haven&#8217;t removed the original names to avoid breaking changes.<\/p>\n<p>In this major version, we removed these previously deprecated aliases and options to keep our code base clean and maintainable for the coming releases.<\/p>\n<h3 id=\"new-commands\">New commands<\/h3>\n<p>Aside from changes, we&#8217;ve also introduced a few new commands for managing Microsoft 365.<\/p>\n<h4 id=\"manage-microsoft-to-do-lists\">Manage Microsoft To Do lists<\/h4>\n<p>In August Microsoft released a preview version of new APIs for Microsoft To Do. Following this release, Yannick Plenevaux contributed commands to list, remove and update to do lists.<\/p>\n<p>To retrieve all Microsoft To Do lists, execute:<\/p>\n<pre><code class=\"lang-sh\">m365 todo <span class=\"hljs-built_in\">list<\/span> <span class=\"hljs-built_in\">list<\/span>\n<\/code><\/pre>\n<p>To rename a list, execute:<\/p>\n<pre><code class=\"lang-sh\">m365 todo list <span class=\"hljs-keyword\">set<\/span> --id <span class=\"hljs-string\">\"AAMkAGI3NDhlZmQzLWQxYjAtNGJjNy04NmYwLWQ0M2IzZTNlMDUwNAAuAAAAAACQ1l2jfH6VSZraktP8Z7auAQCbV93BagWITZhL3J6BMqhjAAD9pHIhAAA=\"<\/span> --<span class=\"hljs-keyword\">new<\/span><span class=\"hljs-type\">Name<\/span> <span class=\"hljs-string\">\"My updated task list\"<\/span>\n<\/code><\/pre>\n<p>Finally, to remove a specific list, execute:<\/p>\n<pre><code class=\"lang-sh\">m365 todo <span class=\"hljs-built_in\">list<\/span> remove --<span class=\"hljs-built_in\">name<\/span> <span class=\"hljs-string\">\"My task list\"<\/span>\n<\/code><\/pre>\n<p>For more information about working with Microsoft To Do using CLI for Microsoft 365, see the docs at <a href=\"https:\/\/aka.ms\/cli-m365\">aka.ms\/cli-m365<\/a>.<\/p>\n<h4 id=\"uninstall-personal-teams-app\">Uninstall personal Teams app<\/h4>\n<p>In the past few months, there&#8217;s been a huge increase in Microsoft Teams usage. After the pandemic forced our hand, Teams became the primary tool to facilitate collaboration in many organization, who often had to speed up their rollout plans and let their employees work from home.<\/p>\n<p>While deploying Teams, many organizations want to go beyond the standard setup and offer their employees a set of additional applications they can use to work more effectively. But managing these applications at scale can quickly become cumbersome. To help organizations remove unnecessary apps, Aakash Bhardwaj contributed a command to uninstall personal apps.<\/p>\n<p>To uninstall a personal Teams app, execute:<\/p>\n<pre><code class=\"lang-sh\"><span class=\"hljs-name\">m365<\/span> teams user app remove --appId YzUy<span class=\"hljs-symbol\">N2<\/span>E<span class=\"hljs-number\">0<\/span><span class=\"hljs-symbol\">NzAtYTg4<\/span>Mi<span class=\"hljs-number\">00<\/span>ODFjLTk<span class=\"hljs-number\">4<\/span>MWMtZWU<span class=\"hljs-number\">2<\/span>ZWZhYmE<span class=\"hljs-number\">4<\/span><span class=\"hljs-symbol\">NWM3<\/span>Iy<span class=\"hljs-name\">M0<\/span>ZDFlYTA<span class=\"hljs-number\">0<\/span><span class=\"hljs-symbol\">Ny1<\/span>mMTk<span class=\"hljs-number\">2<\/span>LTQ<span class=\"hljs-number\">1<\/span>MGQtYjJlOS<span class=\"hljs-number\">0<\/span>wZDI<span class=\"hljs-number\">4<\/span><span class=\"hljs-symbol\">NTViYTA1<\/span>YTY= --userId <span class=\"hljs-number\">2609<\/span>af<span class=\"hljs-number\">39<\/span><span class=\"hljs-number\">-7775<\/span><span class=\"hljs-number\">-4<\/span>f<span class=\"hljs-number\">94<\/span>-a<span class=\"hljs-number\">3<\/span>dc<span class=\"hljs-number\">-0<\/span>dd<span class=\"hljs-number\">67657<\/span>e<span class=\"hljs-number\">900<\/span>\n<\/code><\/pre>\n<p>For more information about managing Microsoft Teams using CLI for Microsoft 365, see the docs at <a href=\"https:\/\/aka.ms\/cli-m365\">aka.ms\/cli-m365<\/a>.<\/p>\n<h4 id=\"list-groups-from-specific-web\">List groups from specific web<\/h4>\n<p>One of the most complex areas of governing Microsoft 365 is permission management. Across Microsoft 365, different services have a different way of managing their permissions and which all require separate configuration. One of such services is SharePoint, where each site, list or a file can be secured separately.<\/p>\n<p>To help you keep track of permissions in your sites, Dipen Shah contributed a command that lets you list groups from the specific web.<\/p>\n<p>To get groups from a specific web, execute:<\/p>\n<pre><code class=\"lang-sh\">m365 spo <span class=\"hljs-keyword\">group<\/span> <span class=\"hljs-title\">list<\/span> --webUrl <span class=\"hljs-string\">\"https:\/\/contoso.sharepoint.com\/sites\/contoso\"<\/span>\n<\/code><\/pre>\n<h4 id=\"set-knowledge-hub-site\">Set Knowledge Hub Site<\/h4>\n<p>Preparing for the rollout of Knowledge Hub Sites, Arjun Menon contributed a command that lets you set the knowledge hub site for your tenant.<\/p>\n<p>To set a knowledge hub site for your tenant, execute:<\/p>\n<pre><code class=\"lang-sh\">m365 spo knowledgehub <span class=\"hljs-keyword\">set<\/span> --url <span class=\"hljs-comment\">https:<\/span>\/\/<span class=\"hljs-comment\">contoso.sharepoint.com<\/span>\/sites\/<span class=\"hljs-comment\">knowledgesite<\/span>\n<\/code><\/pre>\n<p>As the functionality is released, you can expect more commands related to managing knowledge sites in CLI for Microsoft 365.<\/p>\n<h2 id=\"contributors\">Contributors<\/h2>\n<p>This release wouldn&#8217;t be also possible without the help of (in alphabetical order) <a href=\"https:\/\/github.com\/aakashbhardwaj619\">Aakash Bhardwaj<\/a>, <a href=\"https:\/\/github.com\/VelinGeorgiev\">Velin Georgiev<\/a>, <a href=\"https:\/\/github.com\/arjunumenon\">Arjun Menon<\/a>, <a href=\"https:\/\/github.com\/waldekmastykarz\">Waldek Mastykarz<\/a>, <a href=\"https:\/\/github.com\/nanddeepn\">Nanddeep Nachan<\/a>, <a href=\"https:\/\/github.com\/ypcode\">Yannick Plenevaux<\/a>, <a href=\"https:\/\/github.com\/romanatsogeti\">Roman Rozinov<\/a>, <a href=\"https:\/\/github.com\/appieschot\">Albert-Jan Schot<\/a>, <a href=\"https:\/\/github.com\/dips365\">Dipen Shah<\/a>, <a href=\"https:\/\/github.com\/garrytrinder\/\">Garry Trinder<\/a>, <a href=\"https:\/\/github.com\/sprider\">Joseph Velliah<\/a> and <a href=\"https:\/\/github.com\/rabwill\">Rabia Williams<\/a> as well as all other contributors we had to date. There wouldn&#8217;t be a v3 without the v2 and v1, which you helped to build. Thank you all so much for the time you chose to spend on CLI for Microsoft 365!<\/p>\n<h2 id=\"what-s-next\">What&#8217;s next<\/h2>\n<p>With the big refactoring behind us, we&#8217;re going to focus on adding more commands and improving the existing ones. Like always, we&#8217;re listening for feedback and ideas for improvements. We can&#8217;t promise we&#8217;ll implement everything, but we will definitely engage in the discussion to better understand your suggestions.<\/p>\n<h3 id=\"more-commands-what-else\">More commands, what else<\/h3>\n<p>Microsoft 365 is evolving and new capabilities are being released every day. With CLI for Microsoft 365, we aim to help you manage your tenant on any platform in a consistent way, no matter which part of Microsoft 365 you interact with. While we keep adding new commands to CLI for Microsoft 365 each release, we still barely scratched the surface with what\u2019s possible in Microsoft 365. In the upcoming versions of the CLI for Microsoft, you can expect us to add more commands across the different workloads in Microsoft 365.<\/p>\n<h3 id=\"script-examples\">Script examples<\/h3>\n<p>In every release of CLI for Microsoft 365, we introduce new commands for managing Microsoft 365. With almost 400 commands across the different Microsoft 365 services, CLI for Microsoft 365 has become a powerful tool, not just for managing your tenant but also for automating your daily work.<\/p>\n<p>We\u2019d love to show you how you can use CLI for Microsoft 365 to build automation scripts in PowerShell Core and Bash. If you have any scripts using SPO or PnP PowerShell that you use frequently, please share them with us so that we can learn more about the common automation scenarios.<\/p>\n<h3 id=\"-ensure-commands\"><code>ensure<\/code> commands<\/h3>\n<p>Currently, CLI for Microsoft 365 has dedicated commands for retrieving, creating, and updating resources. If you were to create a script that ensures a specific configuration, for each resource you\u2019d need to see if it exists, create it if it doesn\u2019t, or update it if it does.<\/p>\n<p>We\u2019re thinking about simplifying this scenario by introducing commands with a new verb named ensure. For example, to ensure that a particular site collection exists, instead of executing a combination of <code>spo site list<\/code>\/<code>spo site get<\/code>, <code>spo site add<\/code> and <code>spo site set<\/code>, you\u2019d execute <code>spo site ensure<\/code> with the necessary parameters which would automatically verify if the particular site exists and matches your configuration. If the site doesn\u2019t exist, it would create it. If it does, the command would check if the properties you specified to match the retrieved site and update them if necessary.<\/p>\n<p>We\u2019ll start to implement this idea on the <code>spo site<\/code> commands. We\u2019d love to hear from you if it\u2019s something that you\u2019d find helpful and what other objects we should take into account.<\/p>\n<h3 id=\"setting-arbitrary-properties-on-sharepoint-objects\">Setting arbitrary properties on SharePoint objects<\/h3>\n<p>At this moment, the most of SharePoint <code>set<\/code> commands in CLI for Microsoft 365 support only a handful of options that correspond to the properties of their SharePoint class, like <code>Web<\/code>, <code>Site<\/code>, <code>List<\/code>, etc. This is similar to how the <code>Set-PnP*<\/code> cmdlets work. However, because PnP PowerShell works with CSOM, this limitation there is often circumvented, by retrieving the CSOM object, updating its properties, and calling <code>$object.ExecuteQuery()<\/code> to persist the changes outside of PnP cmdlets. Because the CLI doesn\u2019t use CSOM, this isn\u2019t possible and users are limited to using whatever options are exposed by the CLI commands.<\/p>\n<p>We\u2019re thinking about addressing this limitation by allowing you to set the value of any property exposed on the SharePoint object. This would work only for properties that have values of simple types like bool, string or int because complex values likely can\u2019t be serialized to string without additional logic.<\/p>\n<p>We would offer rudimentary logic of checking if the specified properties are valid, by examining the latest version of the SPO CSOM assemblies and checking which properties on the particular SharePoint class have setters and values of the supported types and thus can be used.<\/p>\n<p>What do you think of this approach? Would this help to solve a problem you have? In the previous release, we have extended the spo web set command with this functionality. We\u2019d love you to try it and tell us what you think.<\/p>\n<h2 id=\"try-it-today\">Try it today<\/h2>\n<p>Get the latest release of CLI for Microsoft 365 from npm by executing in the command line:<\/p>\n<pre><code class=\"lang-sh\"><span class=\"hljs-selector-tag\">npm<\/span> <span class=\"hljs-selector-tag\">i<\/span> <span class=\"hljs-selector-tag\">-g<\/span> @<span class=\"hljs-keyword\">pnp<\/span>\/<span class=\"hljs-keyword\">cli<\/span>-<span class=\"hljs-keyword\">microsoft365<\/span>\n<\/code><\/pre>\n<p>If you need more help getting started or want more details about the commands, the architecture or the project, go to <a href=\"https:\/\/aka.ms\/cli-m365\">aka.ms\/cli-m365<\/a>. If you see any room for improvement, please, don&#8217;t hesitate to reach out to us either on <a href=\"https:\/\/github.com\/pnp\/cli-microsoft365\/discussions\">GitHub<\/a>, or on twitter with the #CLIMicrosoft365 hashtag.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We&#8217;ve just published a new version of CLI for Microsoft 365 with commands for managing Microsoft 365 tenants and SharePoint Framework projects on any platform.<\/p>\n","protected":false},"author":69079,"featured_media":25159,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[11],"tags":[143,53,140,19],"class_list":["post-5142","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-office-add-ins","tag-cli-for-microsoft-365","tag-office-365","tag-office-365-cli","tag-sharepoint-framework"],"acf":[],"blog_post_summary":"<p>We&#8217;ve just published a new version of CLI for Microsoft 365 with commands for managing Microsoft 365 tenants and SharePoint Framework projects on any platform.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/5142","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/users\/69079"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/comments?post=5142"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/5142\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media\/25159"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media?parent=5142"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/categories?post=5142"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/tags?post=5142"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}