{"record":{"id":"96355e3518a01c51","repo":"BerriAI/litellm","slug":"missing-required-environment-variable-azure-stora","errorCode":null,"errorMessage":"Missing required environment variable: AZURE_STORAGE_ACCOUNT_NAME","messagePattern":"Missing required environment variable: AZURE_STORAGE_ACCOUNT_NAME","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/integrations/azure_storage/azure_storage.py","lineNumber":42,"sourceCode":"\nclass AzureBlobStorageLogger(CustomBatchLogger):\n    def __init__(\n        self,\n        **kwargs,\n    ):\n        try:\n            verbose_logger.debug(\"AzureBlobStorageLogger: in init azure blob storage logger\")\n\n            # Env Variables used for Azure Storage Authentication\n            self.tenant_id = os.getenv(\"AZURE_STORAGE_TENANT_ID\")\n            self.client_id = os.getenv(\"AZURE_STORAGE_CLIENT_ID\")\n            self.client_secret = os.getenv(\"AZURE_STORAGE_CLIENT_SECRET\")\n            self.azure_storage_account_key: str | None = os.getenv(\"AZURE_STORAGE_ACCOUNT_KEY\")\n\n            # Required Env Variables for Azure Storage\n            _azure_storage_account_name: Final = os.getenv(\"AZURE_STORAGE_ACCOUNT_NAME\")\n            if not _azure_storage_account_name:\n                raise ValueError(\"Missing required environment variable: AZURE_STORAGE_ACCOUNT_NAME\")\n            self.azure_storage_account_name: str = _azure_storage_account_name\n            _azure_storage_file_system: Final = os.getenv(\"AZURE_STORAGE_FILE_SYSTEM\")\n            if not _azure_storage_file_system:\n                raise ValueError(\"Missing required environment variable: AZURE_STORAGE_FILE_SYSTEM\")\n            self.azure_storage_file_system: str = _azure_storage_file_system\n            self.azure_storage_endpoint_suffix: str = (\n                os.getenv(\"AZURE_STORAGE_ENDPOINT_SUFFIX\") or AZURE_STORAGE_DEFAULT_ENDPOINT_SUFFIX\n            )\n            self._service_client = None\n            # Time that the azure service client expires, in order to reset the connection pool and keep it fresh\n            self._service_client_timeout: float | None = None\n\n            # Internal variables used for Token based authentication\n            self.azure_auth_token: str | None = None  # the Azure AD token to use for Azure Storage API requests\n            self.token_expiry: datetime | None = None  # the expiry time of the currentAzure AD token\n\n            asyncio.create_task(self.periodic_flush())\n            self.flush_lock = asyncio.Lock()","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/integrations/azure_storage/azure_storage.py#L24-L60","documentation":"The AzureBlobStorageLogger (custom callback that writes litellm logs to ADLS Gen2) reads its storage account name exclusively from the AZURE_STORAGE_ACCOUNT_NAME environment variable — there is no constructor parameter fallback. If unset/empty at logger init, it raises ValueError immediately. Note this init code sits inside a try block; the ValueError may be caught by the surrounding handler depending on caller.","triggerScenarios":"Enabling the azure_storage callback (litellm.callbacks=['azure_storage'] or proxy config) without AZURE_STORAGE_ACCOUNT_NAME in the process env; env var set only in the proxy container but logs written from a worker; name misspelled.","commonSituations":"Following the Azure Storage docs page but skipping the env setup step; deploying via Docker/K8s where the env var was added to one service but not the logging path; account name confused with the full URL (must be the bare account name, e.g. mystorageaccount not https://mystorageaccount.dfs.core.windows.net).","solutions":["Export AZURE_STORAGE_ACCOUNT_NAME=<account-name> (bare name, no URL) in the environment where litellm runs","Set AZURE_STORAGE_FILE_SYSTEM too — init checks it right after (see error 330)","Optionally configure AZURE_STORAGE_TENANT_ID/CLIENT_ID/CLIENT_SECRET (or ACCOUNT_KEY) for auth","For Docker/K8s deployments add the variable to the container/pod spec and restart"],"exampleFix":"# before\n# env: nothing set -> ValueError: Missing required environment variable: AZURE_STORAGE_ACCOUNT_NAME\n\n# after\nexport AZURE_STORAGE_ACCOUNT_NAME=mystorageaccount\nexport AZURE_STORAGE_FILE_SYSTEM=mycontainer\nexport AZURE_STORAGE_TENANT_ID=<guid>\nexport AZURE_STORAGE_CLIENT_ID=<guid>\nexport AZURE_STORAGE_CLIENT_SECRET=<secret>","handlingStrategy":"validation","validationCode":"import os\n\nfor var in (\"AZURE_STORAGE_ACCOUNT_NAME\", \"AZURE_STORAGE_FILE_SYSTEM\"):\n    if not os.getenv(var):\n        raise RuntimeError(f\"Missing required environment variable: {var}\")\n\nname = os.getenv(\"AZURE_STORAGE_ACCOUNT_NAME\", \"\")\nassert \"/\" not in name and \"http\" not in name, \"use the bare account name, not a URL\"","typeGuard":"def is_bare_account_name(v: str | None) -> bool:\n    return isinstance(v, str) and v != \"\" and \"/\" not in v and not v.startswith(\"http\")","tryCatchPattern":"try:\n    AzureBlobStorageLogger()\nexcept ValueError as e:\n    if \"AZURE_STORAGE_ACCOUNT_NAME\" in str(e):\n        raise SystemExit(\"Set AZURE_STORAGE_ACCOUNT_NAME to the bare storage account name\") from e\n    raise","preventionTips":["Set both AZURE_STORAGE_ACCOUNT_NAME and AZURE_STORAGE_FILE_SYSTEM together","Use the bare account name (no https:// suffix or domain)","Add both vars to container specs and restart after changes","Validate storage env vars at startup before enabling the azure_storage callback"],"tags":["azure","azure-storage","logging-callback","environment-variables","configuration"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}