fastapi-azure-auth
Easy and secure implementation of Azure Entra ID for your FastAPI APIs
Decision gist · record as of 2026-08-14
Yes. The package is actively maintained, has no known vulnerabilities, low install friction, and directly solves a common enterprise requirement. If your FastAPI application needs Azure Entra ID authentication, this is a purpose-built solution that handles the OAuth2 and token validation details. Install it if you are deploying to an Azure-centric organization; skip it if you use a different identity provider.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Azure Entra ID tenant and application registration; OAuth2 configuration in FastAPI app must include swagger_ui_oauth2_redirect_url and swagger_ui_init_oauth.
- Low install friction with a pure Python wheel.
- Actively maintained with a recent release (43 days old) and 678 repository stars.
License · maintenance · safety
permissive license (permissive) — MIT license permits commercial and private use with minimal restrictions, making it suitable for enterprise deployments.
last release 2026-07-02 (43 days) · last repo commit 2026-07-02 · 678 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 554,887 downloads/mo, #6,030 on PyPI
Alternatives
Verify before relying
pip install fastapi-azure-auth
from fastapi_azure_auth.auth import SingleTenantAzureAuthorizationCodeBearer
azure_scheme = SingleTenantAzureAuthorizationCodeBearer(
app_client_id='your-client-id',
tenant_id='your-tenant-id',
scopes={'api://your-client-id/user_impersonation': 'user_impersonation'}
)- Whether token caching or refresh-token handling is built in or requires custom implementation.
- Support for custom claim validation beyond standard OpenID Connect claims.
- Performance characteristics under high-concurrency workloads.
What it is and what it does
FastAPI-Azure-Auth integrates Azure Entra ID authentication into FastAPI applications, eliminating the need to build OAuth2 token validation and authorization logic from scratch. It supports single-tenant, multi-tenant, and B2C authentication flows, with scope-based access control and tenant validation. The package wraps FastAPI's OAuth2 security scheme and handles OpenID Connect discovery, token validation via cryptography and pyjwt, and provides Swagger UI integration for interactive authentication during development.
The package depends on fastapi, pydantic for configuration, httpx2 for HTTP calls, cryptography and pyjwt for token verification, and anyio for async operations. Setup involves registering an Azure application, configuring FastAPI with OAuth2 redirect settings, and instantiating the appropriate bearer scheme (SingleTenant, MultiTenant, or B2C) as a dependency. Once configured, routes can enforce authentication and specific scopes declaratively.
Use it for
- Protect FastAPI APIs with Azure Entra ID in enterprise environments where Azure is the identity provider.
- Build multi-tenant SaaS applications that authenticate users from multiple Azure tenants with tenant isolation.
- Implement scope-based authorization to restrict API endpoints to users with specific permissions.
- Add Swagger UI authentication to FastAPI OpenAPI documentation for testing authenticated endpoints interactively.
- Migrate existing Azure AD authentication from other frameworks to FastAPI without rewriting auth logic.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The package is actively maintained, has no known vulnerabilities, low install friction, and directly solves a common enterprise requirement. If your FastAPI application needs Azure Entra ID authentication, this is a purpose-built solution that handles the OAuth2 and token validation details. Install it if you are deploying to an Azure-centric organization; skip it if you use a different identity provider.
Install
fastapi-azure-auth on PyPI
Before you install
Low install friction with a pure Python wheel. Actively maintained with a recent release (43 days old) and 678 repository stars. Supports current Python versions (3.11–3.14).
Requires Azure Entra ID tenant and application registration; OAuth2 configuration in FastAPI app must include swagger_ui_oauth2_redirect_url and swagger_ui_init_oauth.
License in practice
MIT license permits commercial and private use with minimal restrictions, making it suitable for enterprise deployments.
Quickstart
pip install fastapi-azure-auth
from fastapi_azure_auth.auth import SingleTenantAzureAuthorizationCodeBearer
azure_scheme = SingleTenantAzureAuthorizationCodeBearer(
app_client_id='your-client-id',
tenant_id='your-tenant-id',
scopes={'api://your-client-id/user_impersonation': 'user_impersonation'}
)
Verify before relying
- Whether token caching or refresh-token handling is built in or requires custom implementation.
- Support for custom claim validation beyond standard OpenID Connect claims.
- Performance characteristics under high-concurrency workloads.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.11 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 6 packagesanyiocryptographyfastapihttpx2pydanticpyjwt |
| Maintenance | Actively maintained 43 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 554,887 / month, #6,030 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software DevelopmentTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Application FrameworksTopic :: Software Development :: Libraries :: Python Modules |
Evidence: fastapi_azure_auth-5.3.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “azure entra id fastapi”
- fastapi-azure-authAdds Azure Entra ID (formerly Azure AD) authentication and…
- identityProvides a high-level authentication and authorization API for Python…
- azure-identityProvides Microsoft Entra ID token-based authentication for Azure SDK…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also identity · axioms-fastapi · fastapi-auth0 · msal · azure-identity · fastapi-keycloak-middleware · redis-entraid · fastapi-cloudauth · fastapi-cli · cadwyn