{"record":{"id":"330509767a38c8b5","repo":"deepset-ai/haystack","slug":"please-provide-an-azure-endpoint-or-set-the-enviro","errorCode":null,"errorMessage":"Please provide an Azure endpoint or set the environment variable AZURE_OPENAI_ENDPOINT.","messagePattern":"Please provide an Azure endpoint or set the environment variable AZURE_OPENAI_ENDPOINT\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"haystack/components/embedders/azure_document_embedder.py","lineNumber":121,"sourceCode":"        :param max_retries: Maximum number of retries to contact AzureOpenAI after an internal error.\n            If not set, defaults to either the `OPENAI_MAX_RETRIES` environment variable or to 5 retries.\n        :param default_headers: Default headers to send to the AzureOpenAI client.\n        :param azure_ad_token_provider: A function that returns an Azure Active Directory token, will be invoked on\n            every request.\n        :param http_client_kwargs:\n            A dictionary of keyword arguments to configure a custom `httpx.Client`or `httpx.AsyncClient`.\n            For more information, see the [HTTPX documentation](https://www.python-httpx.org/api/#client).\n        :param raise_on_failure:\n            Whether to raise an exception if the embedding request fails. If `False`, the component will log the error\n            and continue processing the remaining documents. If `True`, it will raise an exception on failure.\n        \"\"\"\n        # We intentionally do not call super().__init__ here because we only need to instantiate the client to interact\n        # with the API.\n\n        # if not provided as a parameter, azure_endpoint is read from the env var AZURE_OPENAI_ENDPOINT\n        azure_endpoint = azure_endpoint or os.environ.get(\"AZURE_OPENAI_ENDPOINT\")\n        if not azure_endpoint:\n            raise ValueError(\"Please provide an Azure endpoint or set the environment variable AZURE_OPENAI_ENDPOINT.\")\n\n        if api_key is None and azure_ad_token is None:\n            raise ValueError(\"Please provide an API key or an Azure Active Directory token.\")\n\n        self.api_key = api_key  # type: ignore[assignment] # mypy does not understand that api_key can be None\n        self.azure_ad_token = azure_ad_token\n        self.api_version = api_version\n        self.azure_endpoint = azure_endpoint\n        self.azure_deployment = azure_deployment\n        self.model = azure_deployment\n        self.dimensions = dimensions\n        self.organization = organization\n        self.prefix = prefix\n        self.suffix = suffix\n        self.batch_size = batch_size\n        self.progress_bar = progress_bar\n        self.meta_fields_to_embed = meta_fields_to_embed or []\n        self.embedding_separator = embedding_separator","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/deepset-ai/haystack/blob/e318778c9bf60a1963e3b5f451359655dd696c30/haystack/components/embedders/azure_document_embedder.py#L103-L139","documentation":"AzureOpenAIDocumentEmbedder requires an Azure OpenAI endpoint. In __init__, the azure_endpoint parameter falls back to the AZURE_OPENAI_ENDPOINT environment variable; if both are absent, ValueError is raised. Without an endpoint, the Azure OpenAI client cannot be constructed.","triggerScenarios":"Instantiating AzureOpenAIDocumentEmbedder() with no azure_endpoint argument while AZURE_OPENAI_ENDPOINT is unset or empty in the process environment.","commonSituations":"Env var defined in shell but not in the deployment/CI environment; using a `.env` file without loading it; running in Docker/Kubernetes without passing the variable; typo in the variable name.","solutions":["Set the environment variable: export AZURE_OPENAI_ENDPOINT=\"https://<your-resource>.openai.azure.com/\".","Or pass it explicitly: AzureOpenAIDocumentEmbedder(azure_endpoint=\"https://<your-resource>.openai.azure.com/\").","If using a .env file, load it (python-dotenv) before instantiating the component.","Verify the variable is visible to the process (os.environ check) — shells, IDEs, and containers have different env scopes."],"exampleFix":"# before\nembedder = AzureOpenAIDocumentEmbedder()  # no endpoint anywhere\n# after\nimport os\nembedder = AzureOpenAIDocumentEmbedder(\n    azure_endpoint=os.environ[\"AZURE_OPENAI_ENDPOINT\"],\n    azure_deployment=\"my-embedding-deployment\",\n    api_key=os.environ[\"AZURE_OPENAI_API_KEY\"],\n)","handlingStrategy":"validation","validationCode":"import os\n\nazure_endpoint = azure_endpoint or os.environ.get(\"AZURE_OPENAI_ENDPOINT\")\nif not azure_endpoint:\n    raise ValueError(\n        \"Set AZURE_OPENAI_ENDPOINT or pass azure_endpoint to AzureOpenAIDocumentEmbedder\"\n    )","typeGuard":null,"tryCatchPattern":"try:\n    embedder = AzureOpenAIDocumentEmbedder(azure_endpoint=endpoint, api_key=key)\nexcept ValueError as e:\n    if \"AZURE_OPENAI_ENDPOINT\" in str(e):\n        raise RuntimeError(\n            \"Deployment misconfiguration: AZURE_OPENAI_ENDPOINT missing. \"\n            \"Check container/CI env vars and .env loading.\"\n        ) from e\n    raise","preventionTips":["Load .env files (python-dotenv) at application startup before building pipelines","Verify required env vars at process start with a fail-fast config check","In Docker/Kubernetes/CI, declare AZURE_OPENAI_ENDPOINT in the environment explicitly","Validate with: assert os.environ.get(\"AZURE_OPENAI_ENDPOINT\"), 'missing endpoint'"],"tags":["python","azure","configuration","env-var","missing-credential"],"backgroundTag":"missing-env-var","analyzedSha":"e318778c9bf60a1963e3b5f451359655dd696c30","analyzedAt":"2026-08-30T11:45:20.711Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}