Skip to content

Python based command line tools for interacting with Microsoft Graph

License

Notifications You must be signed in to change notification settings

BelieveInBunny/msgraph-cli

 
 

Repository files navigation

This repository has been archived. The Microsoft Graph CLI is now being developed here: https://github.com/microsoftgraph/msgraph-cli.

Microsoft Graph CLI

It is said that imitation is the sincerest form of flattery and if you are familiar with the Azure CLI, you can tell we are fans. The Microsoft Graph CLI leverages the same tool chain that is used to build the Azure CLI, but instead brings the entire surface area of Microsoft Graph to your command shell.

This project is still in its early phases, but we are building not only on the work of the Azure CLI team but also on the Microsoft Graph PowerShell SDK project to enable us to quickly generate a CLI for all the new capabilities of Microsoft Graph as soon as they are available.

Installation

Windows

Download directly from the releases.

Usage

$ mgc [ group ] [ command ] {parameters}

Get Started

Login

$ mgc login --scopes "user.read.all"

Query

You can use the --query parameter and the JMESPath query syntax to customize your output.

$ mgc users user list --query "[?userType=='Member'].{name: displayName, email: mail}" --output table

Extensions

You can manage extensions using the extension command. Currently, beta commands aren't shipped with the CLI and are available as extensions.

To view the list of available extensions, use the list-available sub-command

$ mgc extension list-available

To add an extension, use the add sub-command

$ mgc extension add --name extensionname

To remove an extension, use the remove sub-command

$ mgc extension remove --name extensionname

For more help on the extension capabilities, use the command

$ mgc extension --help
Name                      Email
------------------------  -------------------------------------
Conf Room Adams           [email protected]
Adele Vance               [email protected]
MOD Administrator         [email protected]
Alex Wilber               [email protected]

Exit codes

For scripting purposes, we output certain exit codes for differing scenarios.

Exit Code Scenario
0 Command ran successfully.
1 Generic error; server returned bad status code, CLI validation failed, etc.
2 Parser error; check input to command line.

Common scenarios and use Microsoft Graph CLI effectively

More samples and snippets

Reporting issues and feedback

If you encounter any bugs with the tool please file an issue in the Issues section of our GitHub repo.

Developer setup

If you would like to setup a development environment and contribute to the CLI, read Setting Up Your Development Environment.

Contribute code

This project has adopted the Microsoft Open Source Code of Conduct.

For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

About

Python based command line tools for interacting with Microsoft Graph

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%
  • Ruby 0.0%
  • Rich Text Format 0.0%
  • Batchfile 0.0%
  • Shell 0.0%
  • Dockerfile 0.0%