{"record":{"id":"4e6282db038cbbf1","repo":"NousResearch/hermes-agent","slug":"the-azure-identity-package-is-required-for-azure-4e6282","errorCode":null,"errorMessage":"The 'azure-identity' package is required for Azure AI Foundry Entra ID authentication. {exc}","messagePattern":"The 'azure-identity' package is required for Azure AI Foundry Entra ID authentication\\. (.+?)","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"agent/azure_identity_adapter.py","lineNumber":94,"sourceCode":"    package is missing and lazy installs are disabled.\n    \"\"\"\n    try:\n        import azure.identity as _ai\n        return _ai\n    except ImportError:\n        try:\n            from tools.lazy_deps import ensure, FeatureUnavailable\n        except ImportError as exc:\n            raise ImportError(\n                \"The 'azure-identity' package is required for Azure AI \"\n                \"Foundry Entra ID authentication. Install it with: \"\n                \"pip install azure-identity\"\n            ) from exc\n\n        try:\n            ensure(_AZURE_IDENTITY_FEATURE, prompt=False)\n        except FeatureUnavailable as exc:\n            raise ImportError(\n                \"The 'azure-identity' package is required for Azure AI \"\n                \"Foundry Entra ID authentication. \" + str(exc)\n            ) from exc\n\n        # Retry import after lazy install.\n        import azure.identity as _ai  # noqa: WPS440\n        return _ai\n\n\ndef reset_credential_cache() -> None:\n    \"\"\"Clear the cached ``DefaultAzureCredential``. Used by tests and\n    profile switches.\n\n    Defensive against tests that ``monkeypatch.setattr`` over\n    ``build_credential`` with a plain (non-lru-cached) function — those\n    won't expose ``cache_clear()`` until pytest reverts the patch.\n    \"\"\"\n    cache_clear = getattr(build_credential, \"cache_clear\", None)","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/NousResearch/hermes-agent/blob/c896c09c42910c584c4c7d2325b58c14713ea42c/agent/azure_identity_adapter.py#L76-L112","documentation":"azure.identity is missing and the lazy-install attempt via tools.lazy_deps.ensure(_AZURE_IDENTITY_FEATURE, prompt=False) raised FeatureUnavailable — meaning the runtime context (no interactivity, no network for install, or feature disabled) cannot auto-install it. The original FeatureUnavailable message is appended so the precise reason is visible.","triggerScenarios":"Azure Foundry + Entra auth selected in a non-interactive or offline runtime where lazy dependency installation is disabled/unavailable (agent/azure_identity_adapter.py:94).","commonSituations":"Gateway/cron/daemon context with prompt=False; offline machine; CI environment blocking pip installs.","solutions":["Pre-install in the runtime's environment: pip install azure-identity.","If installs are blocked, enable network/permission for the lazy-dep feature or install the requirement into the image.","Read the appended FeatureUnavailable text — it states whether it was disabled by config or failed to install."],"exampleFix":"pip install azure-identity","handlingStrategy":"try-catch","validationCode":"import importlib.util\nif importlib.util.find_spec(\"azure.identity\") is None:\n    raise SystemExit(\"azure-identity required — install it in the image (lazy installs are disabled here)\")","typeGuard":null,"tryCatchPattern":"try:\n    _import_azure_identity()\nexcept ImportError as e:\n    if \"azure-identity\" in str(e):\n        log.error(\"pre-install azure-identity; lazy install unavailable: %s\", e)\n        raise","preventionTips":["Pre-install optional deps in non-interactive/offline runtimes; never rely on lazy installs there.","Bake azure-identity into container images for Foundry deployments."],"tags":["azure","entra-id","dependency-install","offline"],"backgroundTag":null,"analyzedSha":"c896c09c42910c584c4c7d2325b58c14713ea42c","analyzedAt":"2026-08-14T17:18:01.089Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}