{"record":{"id":"ff7a561cd0ee177c","repo":"pola-rs/polars","slug":"azure-identity-must-be-installed-to-use-credentia","errorCode":null,"errorMessage":"azure-identity must be installed to use `CredentialProviderAzure`","messagePattern":"azure-identity must be installed to use `CredentialProviderAzure`","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/io/cloud/credential_provider/_providers.py","lineNumber":457,"sourceCode":"                if verbose:\n                    eprint(\n                        \"[CredentialProviderAzure]: Retrieved account key from Azure CLI\"\n                    )\n            except Exception as e:\n                if verbose:\n                    eprint(\n                        f\"[CredentialProviderAzure]: Could not retrieve account key from Azure CLI: {e}\"\n                    )\n            else:\n                return creds, None\n\n        return None\n\n    @classmethod\n    def _ensure_module_availability(cls) -> None:\n        if importlib.util.find_spec(\"azure.identity\") is None:\n            msg = \"azure-identity must be installed to use `CredentialProviderAzure`\"\n            raise ImportError(msg)\n\n    @staticmethod\n    def _extract_adls_uri_storage_account(uri: str) -> str | None:\n        # \"abfss://{CONTAINER}@{STORAGE_ACCOUNT}.dfs.core.windows.net/\"\n        #                      ^^^^^^^^^^^^^^^^^\n        try:\n            return (\n                uri.split(\"://\", 1)[1]\n                .split(\"/\", 1)[0]\n                .split(\"@\", 1)[1]\n                .split(\".dfs.core.windows.net\", 1)[0]\n            )\n\n        except IndexError:\n            return None\n\n    @classmethod\n    def _get_azure_storage_account_key_az_cli(cls, account_name: str) -> str:","sourceCodeStart":439,"sourceCodeEnd":475,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/io/cloud/credential_provider/_providers.py#L439-L475","documentation":"CredentialProviderAzure depends on the azure-identity package. _ensure_module_availability checks for azure.identity at construction and raises ImportError if it is missing, giving an actionable message instead of a later import crash.","triggerScenarios":"Using credential_provider='azure' or instantiating CredentialProviderAzure without azure-identity installed (and without an account key available from another permitted source).","commonSituations":"Bare polars install in a slim docker image; forgetting the Azure extra when setting up a new service; environments where only account-key auth was previously used.","solutions":["pip install azure-identity.","Install the polars cloud extra, e.g. pip install 'polars[azure]'.","Supply an Azure storage account key via a permitted config path so the identity package isn't needed."],"exampleFix":"// before\n provider = pl.CredentialProviderAzure()\n// after\n # pip install azure-identity\n provider = pl.CredentialProviderAzure()","handlingStrategy":"try-catch","validationCode":"import importlib.util\nif importlib.util.find_spec('azure.identity') is None:\n    raise RuntimeError('install azure-identity before using CredentialProviderAzure')","typeGuard":"def azure_identity_available() -> bool:\n    return importlib.util.find_spec('azure.identity') is not None","tryCatchPattern":"try:\n    provider = pl.CredentialProviderAzure()\nexcept ImportError as e:\n    if 'azure-identity must be installed' in str(e):\n        provider = None  # fall back to account key / connection string auth\n    else:\n        raise","preventionTips":["Add azure-identity (or 'polars[azure]') to requirements for Azure workloads.","Verify provider dependencies in a startup health check.","Keep docker images and CI environments consistent with the extras declared in pyproject."],"tags":["python","azure","missing-dependency","credentials"],"backgroundTag":"missing-optional-dependency","analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}