{"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/df599052daf96e7a9cc30a3b0c6bd25d6947e3c0/py-polars/src/polars/io/cloud/credential_provider/_providers.py#L439-L475","documentation":"CredentialProviderAzure._ensure_module_availability (py-polars/src/polars/io/cloud/credential_provider/_providers.py:452-457) checks importlib.util.find_spec('azure.identity') and raises ImportError when the Python Azure credential provider is needed but azure-identity is not installed. It is only reached when no user `credential` object was supplied and no account key could be retrieved from the Azure CLI.","triggerScenarios":"pl.scan_parquet('az://container/f.parquet') (or abfss://) with no storage_options key, no az login, and no azure-identity package; or explicitly via pl.CredentialProviderAzure().","commonSituations":"Fresh CI/deployment images without the Azure extra; code that previously only read public containers now pointed at private ones.","solutions":["pip install azure-identity","Authenticate the Azure CLI (az login) so the account-key fast path can be used without the package","Pass an account key via storage_options to stay on the native Rust path"],"exampleFix":"# before\nlf = pl.scan_parquet(\"az://container/f.parquet\")  # ImportError\n# after\n# $ pip install azure-identity\nlf = pl.scan_parquet(\"az://container/f.parquet\")","handlingStrategy":"validation","validationCode":"import importlib.util\n\ndef require_azure_identity() -> None:\n    if importlib.util.find_spec(\"azure.identity\") is None:\n        raise ImportError(\"pip install azure-identity for az:///abfss:// access\")","typeGuard":null,"tryCatchPattern":"try:\n    lf = pl.scan_parquet(url)\nexcept ImportError as e:\n    if \"azure-identity\" in str(e):\n        raise SystemExit(\"pip install azure-identity (or pass an account_key via storage_options)\") from e\n    raise","preventionTips":["Ship azure-identity in images that read az:// or abfss:// paths","Alternatively pre-authenticate with az login or pass an account_key","Fail fast on missing optional cloud dependencies at deployment entrypoints"],"tags":["polars","azure","azure-identity","credentials","importerror","dependencies"],"backgroundTag":null,"analyzedSha":"df599052daf96e7a9cc30a3b0c6bd25d6947e3c0","analyzedAt":"2026-08-16T12:10:03.978Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}