{"record":{"id":"e0d83ff61eb0315e","repo":"microsoft/semantic-kernel","slug":"failed-to-create-azure-ai-search-settings","errorCode":null,"errorMessage":"Failed to create Azure AI Search settings.","messagePattern":"Failed to create Azure AI Search settings\\.","errorType":"exception","errorClass":"VectorStoreInitializationException","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/connectors/azure_ai_search.py","lineNumber":783,"sourceCode":"        search_index_client: SearchIndexClient | None = None,\n        embedding_generator: \"EmbeddingGeneratorBase | None\" = None,\n        env_file_path: str | None = None,\n        env_file_encoding: str | None = None,\n    ) -> None:\n        \"\"\"Initializes a new instance of the AzureAISearchStore class.\"\"\"\n        managed_client: bool = False\n        endpoint: str | None = None\n        credential: AzureKeyCredential | AsyncTokenCredential | None = None\n        if not search_index_client:\n            try:\n                azure_ai_search_settings = AzureAISearchSettings(\n                    env_file_path=env_file_path,\n                    endpoint=search_endpoint,\n                    api_key=api_key,\n                    env_file_encoding=env_file_encoding,\n                )\n            except ValidationError as exc:\n                raise VectorStoreInitializationException(\"Failed to create Azure AI Search settings.\") from exc\n            endpoint = str(azure_ai_search_settings.endpoint)\n            credential = _resolve_credential(\n                azure_ai_search_settings,\n                azure_credential=azure_credentials,\n                token_credential=token_credentials,\n            )\n            search_index_client = _get_search_index_client(\n                azure_ai_search_settings=azure_ai_search_settings,\n                azure_credential=azure_credentials,\n                token_credential=token_credentials,\n            )\n            managed_client = True\n        else:\n            endpoint = search_endpoint\n            credential = azure_credentials or token_credentials or (AzureKeyCredential(api_key) if api_key else None)\n\n        super().__init__(\n            search_index_client=search_index_client,","sourceCodeStart":765,"sourceCodeEnd":801,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/connectors/azure_ai_search.py#L765-L801","documentation":"Raised in the AzureAISearchStore constructor when no search_index_client is supplied and AzureAISearchSettings construction raises a pydantic ValidationError. The store-level settings require a valid HTTPS endpoint (HttpsUrl). The original ValidationError is chained via 'from exc'. This is the store-level analogue of errors 1224/1225 (which occur at the collection level).","triggerScenarios":"Constructing AzureAISearchStore() with AZURE_AI_SEARCH_ENDPOINT unset and no search_endpoint argument; endpoint not a valid HTTPS URL; or env_file_encoding misconfigured so the .env fails to load. Since no client is provided, settings must be built from kwargs/env, and the endpoint requirement triggers the failure.","commonSituations":"First-time initialization without environment configuration; endpoint typo; running in a fresh environment/CI where AZURE_AI_SEARCH_ENDPOINT was not injected; wrong .env path.","solutions":["Pass search_endpoint='https://<svc>.search.windows.net' explicitly, or set AZURE_AI_SEARCH_ENDPOINT.","Read exc.__cause__ (the ValidationError) to identify the exact failing field and reason.","Ensure the endpoint uses the https:// scheme (HttpUrl/HttpsUrl rejects http://).","Verify env_file_path and env_file_encoding if loading from a .env file."],"exampleFix":"// before\nstore = AzureAISearchStore()  # AZURE_AI_SEARCH_ENDPOINT not set\n\n// after\nstore = AzureAISearchStore(\n    search_endpoint=\"https://mysvc.search.windows.net\",\n    api_key=\"<key>\",\n)","handlingStrategy":"try-catch","validationCode":"import os\n\ndef require_store_endpoint(search_endpoint=None) -> str:\n    ep = search_endpoint or os.getenv(\"AZURE_AI_SEARCH_ENDPOINT\")\n    if not ep or not ep.startswith(\"https://\"):\n        raise ValueError(\"AZURE_AI_SEARCH_ENDPOINT (https://) required for AzureAISearchStore\")\n    return ep\n\nrequire_store_endpoint()","typeGuard":null,"tryCatchPattern":"from semantic_kernel.exceptions import VectorStoreInitializationException\ntry:\n    store = AzureAISearchStore()\nexcept VectorStoreInitializationException as e:\n    cause = e.__cause__  # pydantic ValidationError\n    for err in cause.errors():\n        print(err[\"loc\"], err[\"msg\"])\n    raise","preventionTips":["Set AZURE_AI_SEARCH_ENDPOINT (https://) before constructing AzureAISearchStore.","Inspect the chained ValidationError to find the failing field.","Share a single settings loader across store and collection construction."],"tags":["configuration","azure-ai-search","startup","settings"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}