BerriAI/litellm · error · ImportError

azure-identity is required for Azure AD Redis authentication

Error message

azure-identity is required for Azure AD Redis authentication. Install it with: pip install azure-identity

What it means

Error "azure-identity is required for Azure AD Redis authentication. Install it with: pip install azure-identity" thrown in BerriAI/litellm.

Source

Thrown at litellm/_redis.py:224

def _build_azure_credential(
    azure_client_id: str | None = None,
    azure_tenant_id: str | None = None,
    azure_client_secret: str | None = None,
):
    """
    Build a long-lived Azure credential object.

    Azure SDK credentials cache tokens internally and handle expiry/refresh
    transparently, so this should be called once and the result reused.
    """
    try:
        from azure.identity import (
            ClientSecretCredential,
            DefaultAzureCredential,
            ManagedIdentityCredential,
        )
    except ImportError:
        raise ImportError(
            "azure-identity is required for Azure AD Redis authentication. Install it with: pip install azure-identity"
        )

    _client_id: Final = azure_client_id or os.environ.get("AZURE_CLIENT_ID")
    _tenant_id: Final = azure_tenant_id or os.environ.get("AZURE_TENANT_ID")
    _client_secret: Final = azure_client_secret or os.environ.get("AZURE_CLIENT_SECRET")

    if _client_id and _tenant_id and _client_secret:
        return ClientSecretCredential(
            client_id=_client_id,
            tenant_id=_tenant_id,
            client_secret=_client_secret,
        )
    elif _client_id:
        return ManagedIdentityCredential(client_id=_client_id)
    else:
        return DefaultAzureCredential()

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Install azure-identity: pip install azure-identity, then retry the Redis connection.

When it happens

Trigger: Thrown at litellm/_redis.py:224 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/e691e628dbac0290. Report an issue: GitHub.