microsoft-agents-authentication-msal
A msal-based authentication library for Microsoft Agents
What it is and what it does
This package wraps Microsoft Authentication Library (MSAL) to provide authentication for agents built with the Microsoft 365 Agents SDK. It abstracts the complexity of obtaining and refreshing OAuth tokens from Azure AD, enabling agents to authenticate securely when calling Microsoft services like Teams, Microsoft Graph, and other Azure resources.
The library supports multiple authentication types (client secret, certificate, managed identity) and is designed to integrate with the broader Microsoft Agents framework. It handles token caching and multi-tenant scenarios, allowing agents to operate across different Azure AD tenants. The package is part of a larger SDK ecosystem for building enterprise conversational AI agents.
Use it for:
- Authenticate a Teams bot or agent to call Microsoft Graph API on behalf of the organization.
- Enable secure agent-to-agent communication within an enterprise Azure AD tenant.
- Use managed identity authentication in Azure-hosted agents to avoid storing secrets.
- Implement on-behalf-of (OBO) flow so agents can act on behalf of signed-in users.
- Build multi-tenant agents that work across different Azure AD organizations.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides MSAL-based authentication for Microsoft Agents, handling token acquisition from Azure AD so agents can securely communicate with Microsoft services including Teams, Graph API, and Azure resources.
Yes. The package is actively maintained, has low install friction, carries a permissive MIT license, and solves a concrete problem for anyone building agents with the Microsoft 365 Agents SDK that need to call Azure AD-protected services. No known vulnerabilities. Install it if you are using the Microsoft Agents framework and need to authenticate with Azure resources.
Install
microsoft-agents-authentication-msal on PyPI
pip
pip install microsoft-agents-authentication-msaluv
uv add microsoft-agents-authentication-msalpoetry
poetry add microsoft-agents-authentication-msalInstalling microsoft-agents-authentication-msal
Before you install
Low friction install with three runtime dependencies. Active maintenance: released 15 days ago, last commit 2026-08-13, repository has 1036 stars and is not archived.
License in practice
MIT license permits commercial and private use with minimal restrictions; suitable for most enterprise and open-source scenarios.
Quickstart
pip install microsoft-agents-authentication-msal
from microsoft_agents_authentication_msal import MsalAuth
# Configure with client credentials from environment
auth = MsalAuth(
client_id=os.getenv('CONNECTIONS__SERVICE_CONNECTION__SETTINGS__CLIENTID'),
client_secret=os.getenv('CONNECTIONS__SERVICE_CONNECTION__SETTINGS__CLIENTSECRET'),
tenant_id=os.getenv('CONNECTIONS__SERVICE_CONNECTION__SETTINGS__TENANTID')
)
Requires Python >= 3.10 and valid Azure AD credentials (client ID, secret/certificate, and tenant ID) configured via environment variables.
Verify before relying
- Whether token caching behavior and refresh intervals are configurable or automatic.
- Specific scopes and permissions required for different Microsoft services (Teams, Graph API, etc.).
- Support for certificate-based and managed identity authentication beyond client secret flow.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — microsoft-agents-hosting-core, msal, requests |
| Maintenance | actively maintained — 15 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 466,871/month — #6,501 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: microsoft_agents_authentication_msal-1.3.0-py3-none-any.whl
Tags
More Security packages
Provides Python bindings to the FreeDesktop.org…
permissive · top 1,000 on PyPI
msalMSAL for Python handles OAuth2 and OpenID…
permissive · top 1,000 on PyPI
joserfcjoserfc implements JOSE standards (JWS, JWE,…
permissive · top 1,000 on PyPI
AuthlibAuthlib provides a complete implementation of…
permissive · top 1,000 on PyPI
argon2-cffi-bindingsProvides low-level CFFI bindings to the…
permissive · top 1,000 on PyPI
adalADAL for Python authenticates applications with…
permissive · top 1,000 on PyPI
microsoft-agents-hosting-fastapiProvides FastAPI integration for building and…
permissive · top 15,000 on PyPI
identityProvides a high-level authentication and…
permissive · top 15,000 on PyPI
microsoft-agents-hosting-aiohttpProvides HTTP hosting integration for Microsoft…
permissive · top 15,000 on PyPI
microsoft-agents-hosting-teamsProvides Teams-specific handlers and utilities…
permissive · top 15,000 on PyPI
microsoft-agents-hosting-coreProvides the core hosting infrastructure for…
permissive · top 5,000 on PyPI
streamlit-msalAdds Microsoft Authentication Library (MSAL)…
unclear · top 15,000 on PyPI
taktile-authProvides authentication and authorization…
permissive · top 15,000 on PyPI
msal-extensionsProvides secure, platform-specific token cache…
permissive · top 1,000 on PyPI