{"id":14384,"date":"2023-06-26T08:00:42","date_gmt":"2023-06-26T15:00:42","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/?p=14384"},"modified":"2023-08-02T07:13:33","modified_gmt":"2023-08-02T14:13:33","slug":"announcing-microsoft-graph-cli-sdk-v1-0-0-preview-release-candidate","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/announcing-microsoft-graph-cli-sdk-v1-0-0-preview-release-candidate\/","title":{"rendered":"Announcing Microsoft Graph CLI v1.0.0-preview release candidate"},"content":{"rendered":"<p>Simplify Microsoft Graph interactions with the intuitive Microsoft Graph CLI now in preview. Microsoft Graph CLI is a command-line tool, generated by <a href=\"https:\/\/learn.microsoft.com\/en-us\/openapi\/kiota\/\">Kiota<\/a>, that provides convenient methods to access Microsoft Graph API capabilities on any operating system and any shell.<\/p>\n<p>The CLI can be used in a variety of scenarios, from quick one-off tasks to complex automation scripts. It supports a wide range of features, including authentication, data retrieval, and data manipulation. Check out what more you can do.<\/p>\n<h2>Cross platform support for the Microsoft Graph CLI<\/h2>\n<p>The CLI tool should work on any terminal. We recommend:<\/p>\n<ul>\n<li><a href=\"https:\/\/apps.microsoft.com\/store\/detail\/windows-terminal\/9N0DX20HK701?hl=en-us&amp;gl=us\">Windows Terminal + version<\/a><\/li>\n<li>MacOS (Minimum version: 10.12 Sierra) terminal<\/li>\n<li>PowerShell version 7.3.2<\/li>\n<\/ul>\n<h3>Installation<\/h3>\n<p>Download the CLI to get started for Windows, Mac, Linux or Docker on the assets link of the latest release: <a href=\"https:\/\/github.com\/microsoftgraph\/msgraph-cli\/releases\">CLI Download<\/a>. Find platform specific nuances on the <a href=\"https:\/\/github.com\/microsoftgraph\/msgraph-cli\">CLI Read Me<\/a>.<\/p>\n<h3>Optional:<\/h3>\n<p>Follow the instructions in\u00a0<a href=\"https:\/\/github.com\/microsoftgraph\/msgraph-cli\/blob\/main\/register-app.md\">Register an application for Microsoft identity platform authentication<\/a>\u00a0to get an application ID (also known as a client ID).<\/p>\n<p>Replace\u00a0YOUR_CLIENT_ID\u00a0with the client ID from your app registration.<\/p>\n<h2>Multiple authentication options for the Microsoft Graph CLI<\/h2>\n<p>The CLI supports multiple authentication options to suit different scenarios for both Delegated and App only experiences.<\/p>\n<p>To view supported authentication options, run the following command<\/p>\n<p>mgc login \u2013help<\/p>\n<h3>Delegated authentication options<\/h3>\n<ol>\n<li>Interactive Browser Authentication:<\/li>\n<\/ol>\n<p>Use this method if you want to authenticate interactively by entering your Microsoft 365 credentials in a web browser.<\/p>\n<p><code>mgc login \u2013-strategy InteractiveBrowser<\/code><\/p>\n<ol>\n<li>Device Code Authentication (default auth option)<\/li>\n<\/ol>\n<p>Use this method if you&#8217;re unable to authenticate directly through a web browser and need to authenticate on a separate device.<\/p>\n<p><code>mgc login \u2013strategy DeviceCode<\/code><\/p>\n<h3>App-only authentication options<\/h3>\n<ol>\n<li><strong>Client Certificate authentication<\/strong><\/li>\n<\/ol>\n<p><code>mgc login --strategy ClientCertificate<\/code><\/p>\n<ol>\n<li>Environment login<\/li>\n<\/ol>\n<p>Supports both certificate files and client secret using environment variables and is used by client application that needs to authenticate itself using a client ID.<\/p>\n<p><code>mgc login --strategy Environment<\/code><\/p>\n<p>Supported environment variables are:<\/p>\n<ul>\n<li>AZURE_TENANT_ID<\/li>\n<li>AZURE_CLIENT_ID<\/li>\n<li>AZURE_CLIENT_SECRET<\/li>\n<li>AZURE_CLIENT_CERTIFICATE_PATH<\/li>\n<li>AZURE_CLIENT_CERTIFICATE_PASSWORD<\/li>\n<li>AZURE_CLIENT_SEND_CERTIFICATE_CHAIN<\/li>\n<\/ul>\n<h3>Support for multiple output formats<\/h3>\n<p>Several output formats are supported using the <strong><em>&#8211;output<\/em><\/strong> option which can display data as JSON (default), table or text.<\/p>\n<p>You can turn off Indent JSON responses using the\u00a0<strong><em>&#8211;json-no-indent\u00a0<\/em><\/strong>argument for the JSON output formatter.<\/p>\n<h2>Usage<\/h2>\n<p>Once installed, you can start using the Microsoft Graph CLI to interact with the Microsoft Graph API. Here are some examples of common commands:<\/p>\n<ul>\n<li>To check permissions for scopes\nAdd <strong style=\"font-size: 1rem; text-align: var(--bs-body-text-align);\">-h<\/strong><span style=\"font-size: 1rem; text-align: var(--bs-body-text-align);\"> to your command to view information that contains documentation links with permissions.<\/span><\/li>\n<\/ul>\n<ul>\n<li>To check logged in user\nYou can access the logged in user&#8217;s details using:\n<code style=\"text-align: var(--bs-body-text-align);\">mgc me get<\/code><\/li>\n<\/ul>\n<ul>\n<li>To get information about a specific user, use the `user` command with the user&#8217;s ID or email address:\n<code style=\"text-align: var(--bs-body-text-align);\">mgc user get --id &lt;user_id&gt;<\/code><\/li>\n<\/ul>\n<ul>\n<li>To create a new group, use the `group` command with the desired group name:\n<code style=\"text-align: var(--bs-body-text-align);\">mgc group create --name &lt;group_name&gt;<\/code><\/li>\n<\/ul>\n<ul>\n<li>To upload a file to OneDrive, use the `drive item` command with the file path and destination drive:\n<code style=\"text-align: var(--bs-body-text-align);\">mgc drive item upload --path &lt;file_path&gt; --drive &lt;drive_id&gt;<\/code><\/li>\n<\/ul>\n<p>For a complete list of available commands and options, refer to the CLI documentation. You can also add <strong>&#8211;debug<\/strong> to your command to get more details on your interactions.<\/p>\n<h3>Samples<\/h3>\n<p>You can find additional samples here (contain sample commands for CMD, PowerShell &amp; Bash)\u00a0<a href=\"https:\/\/github.com\/microsoftgraph\/msgraph-cli\/tree\/main\/samples\">CLI samples<\/a><\/p>\n<h2>Feedback and bug reports<\/h2>\n<p>We welcome your feedback and bug reports for this release candidate version. If you encounter any issues or have suggestions for improvement, please open an issue on the <a href=\"https:\/\/github.com\/microsoftgraph\/msgraph-cli\/issues\">GitHub repository<\/a>.<\/p>\n<h2>Changelog<\/h2>\n<h3>v1.0.0-preview1 (Public Preview)<\/h3>\n<p>Additional capabilities supported in this release include:<\/p>\n<ul>\n<li>support for JMESPath queries via the &#8211;query option\n<code style=\"text-align: var(--bs-body-text-align);\">mgc users list --query \"value[].{Name: displayName, Email: mail}\"<\/code><\/li>\n<\/ul>\n<ul>\n<li>Header command options can now be called multiple times. The header values will now be additive.<\/li>\n<li>Contains documentation links to API reference.<\/li>\n<li>Add automatic page iteration via the\u00a0&#8211;all\u00a0command option.<\/li>\n<\/ul>\n<h2>Roadmap<\/h2>\n<p><span class=\"ui-provider fz b c d e f g h i j k l m n o p q r s t u v w x y z ab ac ae af ag ah ai aj ak\" dir=\"ltr\">The final stable release of the Microsoft Graph CLI will be available by September 2023<\/span>. We are incorporating feedback and addressing reported issues to provide a reliable and efficient tool for developers. Stay tuned for further updates!<\/p>\n<p>Follow us on Twitter <a href=\"https:\/\/twitter.com\/Microsoft365Dev\">@Microsoft365Dev<\/a> to stay up to date on news and announcements. Thank you for trying out the Microsoft Graph CLI release candidate.<\/p>\n<p>Happy coding!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Simplify Microsoft Graph interactions with the intuitive Microsoft Graph CLI now in preview.<\/p>\n","protected":false},"author":117208,"featured_media":14863,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[3],"tags":[254],"class_list":["post-14384","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-microsoft-graph","tag-microsoft-graph-cli"],"acf":[],"blog_post_summary":"<p>Simplify Microsoft Graph interactions with the intuitive Microsoft Graph CLI now in preview.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/14384","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\/117208"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/comments?post=14384"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/14384\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media\/14863"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media?parent=14384"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/categories?post=14384"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/tags?post=14384"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}