{"record":{"id":"7d0df89fd9cc6a00","repo":"BerriAI/litellm","slug":"invalid-azure-blob-storage-url-storage-url","errorCode":null,"errorMessage":"Invalid Azure Blob Storage URL: {storage_url}","messagePattern":"Invalid Azure Blob Storage URL: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/base_llm/files/azure_blob_storage_backend.py","lineNumber":237,"sourceCode":"        )\n        response.raise_for_status()\n\n    async def download_file(self, storage_url: str) -> bytes:\n        \"\"\"\n        Download a file from Azure Blob Storage.\n\n        Args:\n            storage_url: Blob URL in format: https://{account}.blob.{endpoint_suffix}/{container}/{path}\n\n        Returns:\n            bytes: File content\n        \"\"\"\n        try:\n            # Parse blob URL to extract path\n            # URL format: https://{account}.blob.{endpoint_suffix}/{container}/{path}\n            parsed_url: Final = urlparse(storage_url)\n            if \".blob.\" not in (parsed_url.hostname or \"\"):\n                raise ValueError(f\"Invalid Azure Blob Storage URL: {storage_url}\")\n\n            # Extract path after container name\n            _, _, file_path = parsed_url.path.lstrip(\"/\").partition(\"/\")\n            if not file_path:\n                raise ValueError(f\"Invalid Azure Blob Storage URL format: {storage_url}\")\n\n            if self.azure_storage_account_key:\n                # Use Azure SDK (reuse logger's service client)\n                return await self._download_file_with_account_key(file_path)\n            else:\n                # Use REST API (reuse logger's token management)\n                return await self._download_file_with_azure_ad(file_path)\n\n        except Exception as e:\n            verbose_logger.exception(\"Error downloading file from Azure Blob Storage: %s\", e)\n            raise\n\n    async def _download_file_with_account_key(self, file_path: str) -> bytes:","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/base_llm/files/azure_blob_storage_backend.py#L219-L255","documentation":"Raised by AzureBlobStorageBackend when downloading a file whose URL hostname does not contain '.blob.'. The backend parses the storage URL with urlparse and expects the Azure Blob Storage shape https://{account}.blob.{endpoint_suffix}/{container}/{path}; anything else (Gen2 dfs. endpoints, SAS URLs to other services, plain https URLs) is rejected.","triggerScenarios":"Configuring litellm_proxy / enterprise file management with AZURE_STORAGE_BUCKET_URL or a file_url pointing to an endpoint like 'https://acct.dfs.core.windows.net/...' (ADLS Gen2) or a non-Azure URL, then triggering a file download; the hostname check \".blob.\" not in hostname fires.","commonSituations":"Mixing up Azure Data Lake Gen2 (dfs.) and Blob (blob.) endpoints; copying the wrong connection string's endpoint; using a CDN or custom domain in front of the storage account; trailing config mistakes in AZURE_STORAGE_* env vars.","solutions":["Use the blob endpoint form: https://{account}.blob.core.windows.net/{container}/{path}.","If you intended ADLS Gen2, this backend does not support dfs. URLs — create/use a blob endpoint for the same storage account.","Verify AZURE_STORAGE_BUCKET_URL / the stored file_url value is the full blob URL, including container and path.","For custom domains, map them back to the account.blob.core.windows.net form before passing to litellm."],"exampleFix":"# before\nfile_url = 'https://mystorage.dfs.core.windows.net/files/report.pdf'  # ValueError\n\n# after\nfile_url = 'https://mystorage.blob.core.windows.net/files/report.pdf'","handlingStrategy":"validation","validationCode":"from urllib.parse import urlparse\n\ndef is_valid_blob_url(url: str) -> bool:\n    host = urlparse(url).hostname or ''\n    return host.endswith('.blob.core.windows.net') or '.blob.' in host","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Store blob URLs, not Gen2 dfs. endpoints, in your file metadata.","Validate storage URLs at config load time with the hostname check above.","Generate URLs from the Azure SDK (BlobClient.url) instead of string concatenation."],"tags":["azure","blob-storage","url-validation","configuration"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}