{"record":{"id":"601f4dd7ec360db5","repo":"infiniflow/ragflow","slug":"azure-blob-account-name-and-account-key-are-requi","errorCode":null,"errorMessage":"Azure Blob: account_name and account_key are required for the account_key auth mode","messagePattern":"Azure Blob: account_name and account_key are required for the account_key auth mode","errorType":"validation","errorClass":"ConnectorMissingCredentialError","httpStatus":null,"severity":"error","filePath":"common/data_source/azure_blob_connector.py","lineNumber":146,"sourceCode":"        if not mode:\n            if conn_str:\n                mode = \"connection_string\"\n            elif account_name and account_key:\n                mode = \"account_key\"\n            elif container_url and sas_token:\n                mode = \"sas_token\"\n\n        try:\n            if mode == \"connection_string\":\n                if not conn_str:\n                    raise ConnectorMissingCredentialError(\"Azure Blob: connection_string is required for the connection_string auth mode\")\n                if not container_name:\n                    raise ConnectorMissingCredentialError(\"Azure Blob: container_name is required together with connection_string\")\n                svc = BlobServiceClient.from_connection_string(conn_str)\n                self._container_client = svc.get_container_client(container_name)\n            elif mode == \"account_key\":\n                if not (account_name and account_key):\n                    raise ConnectorMissingCredentialError(\"Azure Blob: account_name and account_key are required for the account_key auth mode\")\n                if not container_name:\n                    raise ConnectorMissingCredentialError(\"Azure Blob: container_name is required together with account_name + account_key\")\n                account_url = f\"https://{account_name}.{_AZURE_ENDPOINT_SUFFIX}\"\n                svc = BlobServiceClient(\n                    account_url=account_url,\n                    credential=account_key,\n                )\n                self._container_client = svc.get_container_client(container_name)\n            elif mode == \"sas_token\":\n                if not (container_url and sas_token):\n                    raise ConnectorMissingCredentialError(\"Azure Blob: container_url and sas_token are required for the sas_token auth mode\")\n                # mirrors RAGFlowAzureSasBlob; strip a leading \"?\" so we\n                # never produce a double-\"?\" that breaks SAS auth.\n                normalized_sas = str(sas_token).lstrip(\"?\")\n                full_url = f\"{container_url}?{normalized_sas}\"\n                self._container_client = ContainerClient.from_container_url(full_url)\n            else:\n                raise ConnectorMissingCredentialError(","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/common/data_source/azure_blob_connector.py#L128-L164","documentation":"ConnectorMissingCredentialError from the account_key branch of the Azure Blob connector (common/data_source/azure_blob_connector.py:143-150). account_key auth requires the pair account_name + account_key (the connector builds https://{account_name}.{endpoint_suffix} and passes account_key as the credential); if either half is missing the connector fails fast rather than calling the SDK with partial credentials. The same branch additionally requires container_name.","triggerScenarios":"Data source config resolving to auth mode account_key (explicit auth_mode, or inferred from account_name+account_key) where account_name or account_key is empty/None — e.g. only the key was pasted, or only the account name, or a secret reference failed to resolve leaving account_key blank.","commonSituations":"Pasting the storage account key but forgetting the account name field; environment-based secrets where one variable is undefined; renaming accounts without updating config; misreading the Azure portal keys blade.","solutions":["Supply both account_name (storage account name, e.g. 'mystorageacct') and account_key (one of the two access keys) in the connector config.","If secrets come from environment/secret-manager, verify both resolved to non-empty values before the connector runs.","If you actually have a SAS token or connection string, switch auth_mode to sas_token or connection_string and provide those fields instead."],"exampleFix":"# before\n{\"auth_mode\": \"account_key\", \"account_name\": \"mystorageacct\", \"account_key\": \"\"}\n# after\n{\"auth_mode\": \"account_key\", \"account_name\": \"mystorageacct\", \"account_key\": \"<access-key>\", \"container_name\": \"docs\"}","handlingStrategy":"validation","validationCode":"if cfg.get(\"auth_mode\") == \"account_key\" or (cfg.get(\"account_name\") and cfg.get(\"account_key\")):\n    if not (cfg.get(\"account_name\") and cfg.get(\"account_key\")):\n        raise ValueError(\"account_key mode requires both account_name and account_key\")\n    if not cfg.get(\"container_name\"):\n        raise ValueError(\"account_key mode also requires container_name\")","typeGuard":"def azure_account_key_mode_complete(cfg: dict) -> bool:\n    return bool(cfg.get(\"account_name\")) and bool(cfg.get(\"account_key\")) and bool(cfg.get(\"container_name\"))","tryCatchPattern":"from common.data_source.azure_blob_connector import ConnectorMissingCredentialError\ntry:\n    connector.connect()\nexcept ConnectorMissingCredentialError as e:\n    if \"account_name and account_key\" in str(e):\n        raise RuntimeError(\"Azure data source misconfigured: provide account_name + account_key (+ container_name)\") from e\n    raise","preventionTips":["Copy both the storage account name and one of its two access keys — they are a pair.","If using secret references, assert both resolve to non-empty before connector creation.","Match auth_mode to the credentials you actually have (key vs SAS vs connection string)."],"tags":["connectors","azure","blob-storage","credentials","configuration"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}