msgraph-sdk
The Microsoft Graph Python SDK
What it is and what it does
The Microsoft Graph SDK for Python is an official client library that wraps the Microsoft Graph REST API, allowing Python applications to authenticate and call Microsoft services. It handles credential management through azure-identity, request serialization via kiota serialization libraries, and provides a fluent object model that mirrors the REST API structure. The SDK is async-first by design, using asyncio as its primary concurrency model, though it can be integrated into sync code.
You use it by registering an application, selecting an authentication credential type (ClientSecretCredential for daemon apps, DeviceCodeCredential or InteractiveBrowserCredential for user-interactive flows), creating a GraphServiceClient, and then calling methods on its fluent API to read and write data. The library handles HTTP transport, error handling, and response deserialization automatically.
Use it for:
- Build daemon applications that read or modify user data, calendar events, or team information without user interaction.
- Integrate Microsoft services data into custom Python applications or workflows.
- Automate administrative tasks like user provisioning, group management, or license assignment.
- Create Python-based bots or background services that interact with Microsoft Graph on a schedule.
- Fetch user profile, presence, or organizational hierarchy data for identity and access control decisions.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Python client library for calling Microsoft Graph APIs with async-first support, handling authentication, serialization, and request building against Microsoft services.
Yes. This is the official Microsoft Graph Python client, actively maintained with no known vulnerabilities and low install friction. Use it if you need to call Microsoft Graph APIs from Python—it's the standard choice for Microsoft service integration. The async-first design and comprehensive API coverage make it suitable for both simple scripts and production services, though you'll need to understand async/await patterns and have credentials ready.
Install
msgraph-sdk on PyPI
pip
pip install msgraph-sdkuv
uv add msgraph-sdkpoetry
poetry add msgraph-sdkInstalling msgraph-sdk
Before you install
Low friction: pure Python wheel with 6 runtime dependencies. Active maintenance with a release 9 days ago; repo shows recent commits and 625 stars. Supports Python 3.10 through 3.14.
License in practice
MIT license (permissive): you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install msgraph-sdk
from azure.identity.aio import ClientSecretCredential
from msgraph import GraphServiceClient
credential = ClientSecretCredential('tenant_id', 'client_id', 'client_secret')
client = GraphServiceClient(credentials=credential, scopes=['https://graph.microsoft.com/.default'])
user = await client.users.by_user_id('user_id').get()
Requires Python 3.10 or later. Requires Azure AD application registration and credentials. SDK is async-first; sync usage requires wrapping in asyncio or similar.
Verify before relying
- Whether the package includes offline caching or request batching beyond what msgraph_core provides.
- Performance characteristics when handling large result sets or concurrent requests.
- Completeness of v1.0 API coverage relative to the full Microsoft Graph surface.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 6 — azure-identity, microsoft-kiota-serialization-json, microsoft-kiota-serialization-text, microsoft-kiota-serialization-form, microsoft-kiota-serialization-multipart, msgraph_core |
| Maintenance | actively maintained — 9 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 8,118,879/month — #1,663 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: msgraph_sdk-1.61.0-py3-none-any.whl
Keywords: msgraph, openAPI, Microsoft, Graph
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
msgraph-beta-sdkProvides async-first Python bindings to the…
unclear · top 15,000 on PyPI
office365-rest-python-clientPython client library for Microsoft 365 and…
permissive · top 5,000 on PyPI
msgraphfsProvides a filesystem interface to Microsoft…
permissive · top 5,000 on PyPI
msgraph-coreProvides core HTTP client infrastructure for…
permissive · top 5,000 on PyPI
azure-identityProvides Microsoft Entra ID token-based…
unclear · top 1,000 on PyPI
azure-mgmt-msiManages Azure Managed Service Identities…
permissive · top 5,000 on PyPI
azure-batchProvides a Python client library to submit,…
unclear · top 1,000 on PyPI
azure-kusto-dataQuery and interact with Microsoft Azure Kusto…
permissive · top 5,000 on PyPI
azure-cosmosPython client library for Azure Cosmos DB SQL…
permissive · top 1,000 on PyPI
dotnetcore2Bundles the .NET Core 3.1 runtime as a Python…
permissive · top 15,000 on PyPI