BerriAI/litellm · error · ProxyException

MICROSOFT_TENANT

MICROSOFT_TENANT

Error message

MICROSOFT_TENANT not set. Set it in .env file

What it means

ProxyException raised in the Microsoft SSO callback: MICROSOFT_TENANT is not set in the environment, so the Microsoft auth/tenant-scoped endpoints cannot be constructed. A proxy configuration error requiring the tenant to be added to .env.

Source

Thrown at litellm/proxy/management_endpoints/ui_sso.py:4211

        return_raw_sso_response: bool = False,
    ) -> CustomOpenID | OpenID | dict:
        """
        Get the Microsoft SSO callback response

        Args:
            return_raw_sso_response: If True, return the raw SSO response
        """
        microsoft_client_secret: Final = os.getenv("MICROSOFT_CLIENT_SECRET", None)
        microsoft_tenant: Final = os.getenv("MICROSOFT_TENANT", None)
        if microsoft_client_secret is None:
            raise ProxyException(
                message="MICROSOFT_CLIENT_SECRET not set. Set it in .env file",
                type=ProxyErrorTypes.auth_error,
                param="MICROSOFT_CLIENT_SECRET",
                code=status.HTTP_500_INTERNAL_SERVER_ERROR,
            )
        if microsoft_tenant is None:
            raise ProxyException(
                message="MICROSOFT_TENANT not set. Set it in .env file",
                type=ProxyErrorTypes.auth_error,
                param="MICROSOFT_TENANT",
                code=status.HTTP_500_INTERNAL_SERVER_ERROR,
            )
        microsoft_sso: Final = CustomMicrosoftSSO(
            client_id=microsoft_client_id,
            client_secret=microsoft_client_secret,
            tenant=microsoft_tenant,
            redirect_uri=redirect_url,
            allow_insecure_http=True,
        )
        original_msft_result: Final = (
            await microsoft_sso.verify_and_process(
                request=request,
                convert_response=False,
            )
            or {}

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Set MICROSOFT_TENANT in the .env file and restart the proxy.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/ui_sso.py:4211 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/cb29672d3c0f17f3. Report an issue: GitHub.