November 22nd, 2023

Microsoft Graph CLI v1.0.0 is now generally available

Carol Mbasinge Kigoonya
Senior Product Manager

We are thrilled to announce that Microsoft Graph CLI, the command-line tool that provides convenient methods to access Microsoft Graph API capabilities on any operating system and any shell, is now in general availability. We announced v1.0.0 preview in June and CLI v1.0.0 Release Candidate in September and have since addressed feedback, resolved bugs and added features.

What’s new?

The v1.0.0 release candidate includes the following changes and improvements:

  • Added authentication options: Added managed identity to app-only authentication options. Multiple authentication options help unlock multiple authentication options to support your desired user experiences. The CLI now supports to Delegated authentication options (Device code flow and Interactive browser) and App-only authentication options (Client Secret, Environment Variables and Managed Identity) to connect to Microsoft Graph.

  • Output improvements: Improved efficiency when interacting/manipulating output by adding “raw_json” as an output option, removing quotes from output, reducing verbose logging, improving error messages on authentication failure, and changing output encoding to utf-8 for better compatibility with other tools like jq.

Available output options are table, raw_json, json, text, none.

A screenshot of a computer Description automatically generated

  • Added “me” command: Support for the me command that calls the “me” endpoint for a signed in user to get information about themselves (similar to what you get under users resource e.g. my id, names, calendars, contacts, drives, events etc)

  • Microsoft Graph CLI beta support: Explore the Graph Beta experience, CLI Beta is now accessible through the msgraph-beta-cli GitHub repo. This opens up new possibilities for testing and leveraging cutting-edge features and functionalities.
  • Header support: Fine-tune your Microsoft Graph interactions with comprehensive header support. With the new –headers option, you have more control over your CLI experience. Customize headers as needed to align perfectly with your specific requirements and use cases.

Sample request

Sample response

A black and white screen Description automatically generated

Get Started

Prerequisites

The CLI tool should work on any terminal. We recommend:

  • Windows Terminal 1.18
  • MacOS (Minimum version: 10.12 Sierra) terminal
  • PowerShell version 7.3.2

Installation

Download the CLI to get started for Windows, Mac, Linux or Docker on the assets link of the latest release:

Find platform specific installation nuances on the CLI Read Me.

To learn how to use the CLI, check out the CLI documentation and additional CLI samples from our GitHub repository (contains sample commands for CMD, PowerShell & Bash).

Usage

Once installed, you can start using the Microsoft Graph CLI to interact with the Microsoft Graph API. Here are some examples of common commands:

  • To check permissions for scopes, add -h to your command to view information that contains documentation links with permissions.
  • To get information about a specific user, use the `user` command with the user’s ID or email address:  mgc user get --id <user_id>

  • To create a new group, use the `group` command with the desired group name:

mgc group create --name <group_name>

  • To upload a file to OneDrive, use the `drive item` command with the file path and destination drive:

mgc drive item upload --path <file_path> --drive <drive_id>

  • For a complete list of available commands and options, refer to the CLI documentation. You can also add –debug to your command to get more details on your interactions.

Additional resources

Feedback and bug reports

You can report issues, ask questions, or request features on Microsoft Graph GitHub repository. Thank you for your support and feedback!

Happy coding!

Author

Carol Mbasinge Kigoonya
Senior Product Manager

2 comments

Discussion is closed. Login to edit/delete existing comments.

  • gunther

    Is it possible to run cli in Azure Automate ? How can i install ?

  • Ares ChenMicrosoft employee

    Great done, team! Some feedback for your reference.

    1. Can we install the cli by winget?
    2. Can we have intellisense supporting in Powershell?