skillfed

microsoft-agents-authentication-msal

A msal-based authentication library for Microsoft Agents

microsoft-agents-authentication-msal v1.3.0 466.9K downloads/30d#6,501 on PyPI1,036
Permissive license MIT Active released

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-msal

uv

uv add microsoft-agents-authentication-msal

poetry

poetry add microsoft-agents-authentication-msal

Installing 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

Operating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

azure ad authentication for agentsmsal token managementmicrosoft agents authazure ad token cachingagent authentication libraryentra id agent authsecure agent communication
azure-adagent-frameworkoauth

More Security packages

Further reading