{"record":{"id":"9f4ed93aa1c1c2d6","repo":"stanford-oval/storm","slug":"you-must-supply-azure-ai-search-url-or-set-environ","errorCode":null,"errorMessage":"You must supply azure_ai_search_url or set environment variable AZURE_AI_SEARCH_URL","messagePattern":"You must supply azure_ai_search_url or set environment variable AZURE_AI_SEARCH_URL","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"knowledge_storm/rm.py","lineNumber":1157,"sourceCode":"            from azure.search.documents import SearchClient\n        except ImportError as err:\n            raise ImportError(\n                \"AzureAISearch requires `pip install azure-search-documents`.\"\n            ) from err\n\n        if not azure_ai_search_api_key and not os.environ.get(\n            \"AZURE_AI_SEARCH_API_KEY\"\n        ):\n            raise RuntimeError(\n                \"You must supply azure_ai_search_api_key or set environment variable AZURE_AI_SEARCH_API_KEY\"\n            )\n        elif azure_ai_search_api_key:\n            self.azure_ai_search_api_key = azure_ai_search_api_key\n        else:\n            self.azure_ai_search_api_key = os.environ[\"AZURE_AI_SEARCH_API_KEY\"]\n\n        if not azure_ai_search_url and not os.environ.get(\"AZURE_AI_SEARCH_URL\"):\n            raise RuntimeError(\n                \"You must supply azure_ai_search_url or set environment variable AZURE_AI_SEARCH_URL\"\n            )\n        elif azure_ai_search_url:\n            self.azure_ai_search_url = azure_ai_search_url\n        else:\n            self.azure_ai_search_url = os.environ[\"AZURE_AI_SEARCH_URL\"]\n\n        if not azure_ai_search_index_name and not os.environ.get(\n            \"AZURE_AI_SEARCH_INDEX_NAME\"\n        ):\n            raise RuntimeError(\n                \"You must supply azure_ai_search_index_name or set environment variable AZURE_AI_SEARCH_INDEX_NAME\"\n            )\n        elif azure_ai_search_index_name:\n            self.azure_ai_search_index_name = azure_ai_search_index_name\n        else:\n            self.azure_ai_search_index_name = os.environ[\"AZURE_AI_SEARCH_INDEX_NAME\"]\n","sourceCodeStart":1139,"sourceCodeEnd":1175,"githubUrl":"https://github.com/stanford-oval/storm/blob/fb951af7744dab086e34962e9bc6fe878e145f83/knowledge_storm/rm.py#L1139-L1175","documentation":"Raised by AzureAISearchRM.__init__ when the Azure AI Search service endpoint URL is neither passed as azure_ai_search_url nor found in the AZURE_AI_SEARCH_URL environment variable. The SDK needs the full service endpoint (e.g., https://<service>.search.windows.net) to build a SearchClient, so construction aborts.","triggerScenarios":"Constructing AzureAISearchRM with no azure_ai_search_url argument and no AZURE_AI_SEARCH_URL env var; reached only after the API key check has passed.","commonSituations":"Developer supplied the key but not the endpoint; copied the index name or resource name instead of the full endpoint URL; env var set in local shell but not in the deployed/containerized process.","solutions":["export AZURE_AI_SEARCH_URL=\"https://<your-service-name>.search.windows.net\"","Or pass it explicitly: AzureAISearchRM(azure_ai_search_api_key=..., azure_ai_search_url=\"https://<svc>.search.windows.net\", azure_ai_search_index_name=...)","Copy the exact 'Url' value from the Azure portal's Search service Overview page"],"exampleFix":"# before\nrm = AzureAISearchRM(azure_ai_search_api_key=KEY, azure_ai_search_index_name=IDX)\n\n# after\nrm = AzureAISearchRM(azure_ai_search_api_key=KEY, azure_ai_search_url=\"https://mysvc.search.windows.net\", azure_ai_search_index_name=IDX)","handlingStrategy":"validation","validationCode":"import os\n\ndef has_azure_search_url(explicit=None):\n    return bool(explicit or os.environ.get(\"AZURE_AI_SEARCH_URL\"))\n\nassert has_azure_search_url(), \"Missing AZURE_AI_SEARCH_URL\"","typeGuard":null,"tryCatchPattern":"try:\n    rm = AzureAISearchRM(azure_ai_search_api_key=K, azure_ai_search_index_name=I)\nexcept RuntimeError as e:\n    if \"AZURE_AI_SEARCH_URL\" in str(e):\n        raise SystemExit(\"Set AZURE_AI_SEARCH_URL to https://<service>.search.windows.net\")\n    raise","preventionTips":["Store the full endpoint (scheme + host) in config, not just the resource name","Validate endpoint format with a regex like ^https://[a-z0-9-]+\\.search\\.windows\\.net$","Keep per-environment configs (dev/stage/prod) each with their own URL"],"tags":["azure","env-var","configuration","endpoint-url"],"backgroundTag":"missing-env-var","analyzedSha":"fb951af7744dab086e34962e9bc6fe878e145f83","analyzedAt":"2026-08-28T11:56:54.780Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}