BerriAI/litellm · error · ImportError
azure-identity is required for AzureADCredential. Install it
Error message
azure-identity is required for AzureADCredential. Install it with: pip install azure-identity
What it means
Missing-dependency error from AzureADCredential.get_access_token: the optional azure-identity package is not installed, so DefaultAzureCredential cannot be constructed to mint Azure AD tokens. Install azure-identity (or use a different credential type) to use Azure AD auth.
Source
Thrown at litellm/proxy_auth/credentials.py:105
Get an access token from Azure AD.
Args:
scope: The OAuth2 scope (e.g., "api://my-app/.default")
Returns:
AccessToken with the JWT and expiration.
Raises:
ImportError: If azure-identity is not installed.
"""
if not self._initialized:
try:
from azure.identity import DefaultAzureCredential
self._credential = DefaultAzureCredential()
self._initialized = True
except ImportError:
raise ImportError(
"azure-identity is required for AzureADCredential. Install it with: pip install azure-identity"
)
result: Final = self._credential.get_token(scope)
return AccessToken(token=result.token, expires_on=result.expires_on)
class GenericOAuth2Credential:
"""
Generic OAuth2 client credentials flow.
This works with any OAuth2 provider (Okta, Auth0, Keycloak, etc.)
that supports the client_credentials grant type.
Example:
cred = GenericOAuth2Credential(
client_id="my-client-id",
client_secret="my-client-secret",View on GitHub (pinned to 77b7c6c40c)
Solutions
- Install azure-identity: pip install azure-identity.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/proxy_auth/credentials.py:105 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/2e29fd9514d00f03.
Report an issue: GitHub.