{"id":3415,"date":"2019-09-11T12:24:50","date_gmt":"2019-09-11T19:24:50","guid":{"rendered":"https:\/\/developer.microsoft.com\/en-us\/office\/blogs\/?p=3415"},"modified":"2019-09-11T12:24:50","modified_gmt":"2019-09-11T19:24:50","slug":"new-version-of-the-office-365-cli","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/new-version-of-the-office-365-cli\/","title":{"rendered":"Office 365 CLI version 2 has been released"},"content":{"rendered":"<div>We have just released a new major version of the Office 365 CLI that simplifies managing Office 365 tenants and SharePoint Framework projects on any platform. With one simple login you can now connect to any service in Office 365 and thanks to support for throttling and compression, Office 365 CLI will more reliable handle your scripts at scale.<\/div>\n<div>\n<h2>Manage Office 365 and SharePoint Framework projects on any platform<\/h2>\n<\/div>\n<div>Office 365 CLI is a cross-platform command-line tool that allows you to manage settings of Office 365 tenants and SharePoint Framework projects no matter which operating system or shell you use. Additionally, it combines the management of the different services in Office 365 in a single consistent interface following other familiar tools such as the Azure CLI, npm or git.<\/div>\n<div>\n<h2>New major version<\/h2>\n<\/div>\n<div>Office 365 CLI v2 introduces simplified login and command names as well as a number of improvements that increase its reliability and performance.<\/div>\n<div>\n<h4><strong>Grouping per service vs. grouping per API<\/strong><\/h4>\n<div>In the previous version of the Office 365 CLI, commands were grouped by the API they used to connect to the corresponding service in Office 365. For example, Microsoft Teams commands would start with `<span style=\"color: #808080\">graph teams<\/span>`, because they used the Microsoft Graph but Microsoft Flow commands would start with `<span style=\"color: #808080\">azmgmt flow<\/span>` because they were built using the Azure Management API. This naming convention required the user to know how we implemented the particular command.<\/div>\n<div><\/div>\n<div>To make it easier for you to work with the CLI, we removed the API name from the command name. In Office 365 CLI v2 all command names start with the name of the service to which they belong. Check out the docs at <a href=\"https:\/\/aka.ms\/o365cli\">aka.ms\/o365cli<\/a>\u00a0for the updated list of commands.<\/div>\n<h4><strong>One login<\/strong><\/h4>\n<div>In Office 365 CLI v1, we let you log in separately to each API. You would execute `<span style=\"color: #808080\">spo login<\/span>` to connect to SharePoint or `<span style=\"color: #808080\">graph login<\/span>` to connect to the Microsoft Graph. Theoretically, it gave you the flexibility to use different accounts with different services. In practice however, no one really used the CLI that way. So in Office 365 CLI v2, we decided to move away from the per-service\/-API log in and have one login in the CLI that automatically takes care of the authorization when switching between services.<\/div>\n<div><\/div>\n<div>To login in Office 365 CLI v2, all you need to do is to run the `<span style=\"color: #808080\">login<\/span>` command. Once you&#8217;re signed in, you can start using all commands in the CLI.<\/div>\n<h4><strong>Auto-detect SharePoint URL<\/strong><\/h4>\n<p>Comparing to other Office 365 services, SharePoint Online has a unique URL on every tenant. Where the Microsoft Graph, for example, is always available at `<span style=\"color: #808080\"><em>https:\/\/graph.microsoft.com<\/em><\/span>`, SharePoint needs to be called using its unique URL, like `<span style=\"color: #808080\"><em>https:\/\/contoso.sharepoint.com<\/em><\/span>`.<\/p>\n<div>In the previous version of the Office 365 CLI, when logging in to SharePoint Online, you would specify the URL of your tenant to which you wanted to connect, eg. `<span style=\"color: #808080\"><em>spo login https:\/\/contoso.sharepoint.com<\/em><\/span>`. If you wanted to use admin-level commands, you had to specify the tenant admin URL instead or these commands would fail, eg. `<span style=\"color: #808080\"><em>spo login https:\/\/contoso-admin.sharepoint.com<\/em><\/span>`.<\/div>\n<div><\/div>\n<div>In Office 365 CLI v2 we simplified all this. After logging in to your Office 365 tenant using the `<span style=\"color: #808080\">login<\/span>` command, the CLI will automatically detect the URL of SharePoint Online and automatically switch between the root site or the tenant admin URL depending on the commands you use.<\/div>\n<div><\/div>\n<div>While this approach should work in most cases, it could lead to undesired results when you, for example, work with a multi-geo tenant and want to manage specific geography. In such a case you can use the `<span style=\"color: #808080\"><em>spo set &#8211;url https:\/\/contosoeur.sharepoint.com<\/em><\/span>` command to specify the URL of the geography that you want to manage.<\/div>\n<h2>New commands and improvements<\/h2>\n<div>Aside from big architectural changes, we shipped quite a few new commands for SharePoint, Teams, Flow, Office 365 Groups and the Microsoft Graph as well as some improvements. Check out the <a href=\"https:\/\/pnp.github.io\/office365-cli\/about\/release-notes\/#v200\">release notes<\/a>\u00a0for a full list of what has changed.<\/div>\n<h2>Contributors<\/h2>\n<div>This release wouldn&#8217;t be also possible without the help of (in alphabetical order)<\/div>\n<ul>\n<li><a href=\"https:\/\/github.com\/StfBauer\">Stefan Bauer<\/a> (N8D)<\/li>\n<li><a href=\"https:\/\/github.com\/stijnbrouwers\">Stijn Brouwers<\/a>\u00a0(Amplexor)<\/li>\n<li><a href=\"https:\/\/github.com\/velingeorgiev\">Velin Georgiev<\/a>\u00a0(Pramerica)<\/li>\n<li><a href=\"http:\/\/github.com\/waldekmastykarz\">Waldek Mastykarz<\/a>\u00a0(Rencore)<\/li>\n<li><a href=\"https:\/\/github.com\/mpriem\">Mark Priem<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/appieschot\">Albert-Jan Schot<\/a>\u00a0(Mavention)<\/li>\n<li><a href=\"https:\/\/github.com\/pdtane\">Peter Tane<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/sprider\">Joseph Velliah<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/rabwill\">Rabia Williams<\/a>\u00a0(Engage Squared)<\/li>\n<\/ul>\n<p>as well as all other contributors who helped with previous releases of the Office 365 CLI. There wouldn&#8217;t be a v2 without the v1, which you helped to build. Thank you all so much for the time you chose to spend on the Office 365 CLI!<\/p>\n<h2>Try it today<\/h2>\n<div>Get the latest release of the Office 365 CLI from npm by executing in the command line:<\/div>\n<pre class=\"\"> \nnpm i -g @pnp\/office365-cli\n<\/pre>\n<div>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\/o365cli\">aka.ms\/o365cli<\/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\/office365-cli\/issues\">GitHub<\/a>, on twitter with the #office365cli hashtag or on <a href=\"https:\/\/gitter.im\/office365-cli\/cli\">gitter<\/a>.<\/div>\n<\/div>\n<p><span style=\"font-size: large\"><em>\u201cSharing is caring\u201d<\/em><\/span><\/p>\n<p>&nbsp;<\/p>\n<hr \/>\n<p><i>SharePoint Team, Microsoft &#8211; 11th of September 2019<\/i><\/p>\n","protected":false},"excerpt":{"rendered":"<p>We are happy to announce new major version being released for the Office 365 CLI tool.<\/p>\n","protected":false},"author":69078,"featured_media":3417,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[11],"tags":[],"class_list":["post-3415","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-office-add-ins"],"acf":[],"blog_post_summary":"<p>We are happy to announce new major version being released for the Office 365 CLI tool.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/3415","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\/69078"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/comments?post=3415"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/3415\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media\/3417"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media?parent=3415"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/categories?post=3415"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/tags?post=3415"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}