microsoft/semantic-kernel · error · VectorStoreInitializationException
Failed to create Azure AI Search settings.
Error message
Failed to create Azure AI Search settings.
What it means
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).
Source
Thrown at python/semantic_kernel/connectors/azure_ai_search.py:783
search_index_client: SearchIndexClient | None = None,
embedding_generator: "EmbeddingGeneratorBase | None" = None,
env_file_path: str | None = None,
env_file_encoding: str | None = None,
) -> None:
"""Initializes a new instance of the AzureAISearchStore class."""
managed_client: bool = False
endpoint: str | None = None
credential: AzureKeyCredential | AsyncTokenCredential | None = None
if not search_index_client:
try:
azure_ai_search_settings = AzureAISearchSettings(
env_file_path=env_file_path,
endpoint=search_endpoint,
api_key=api_key,
env_file_encoding=env_file_encoding,
)
except ValidationError as exc:
raise VectorStoreInitializationException("Failed to create Azure AI Search settings.") from exc
endpoint = str(azure_ai_search_settings.endpoint)
credential = _resolve_credential(
azure_ai_search_settings,
azure_credential=azure_credentials,
token_credential=token_credentials,
)
search_index_client = _get_search_index_client(
azure_ai_search_settings=azure_ai_search_settings,
azure_credential=azure_credentials,
token_credential=token_credentials,
)
managed_client = True
else:
endpoint = search_endpoint
credential = azure_credentials or token_credentials or (AzureKeyCredential(api_key) if api_key else None)
super().__init__(
search_index_client=search_index_client,View on GitHub (pinned to c028a0c7dc)
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.
Example fix
// before
store = AzureAISearchStore() # AZURE_AI_SEARCH_ENDPOINT not set
// after
store = AzureAISearchStore(
search_endpoint="https://mysvc.search.windows.net",
api_key="<key>",
) Defensive patterns
Strategy: try-catch
Validate before calling
import os
def require_store_endpoint(search_endpoint=None) -> str:
ep = search_endpoint or os.getenv("AZURE_AI_SEARCH_ENDPOINT")
if not ep or not ep.startswith("https://"):
raise ValueError("AZURE_AI_SEARCH_ENDPOINT (https://) required for AzureAISearchStore")
return ep
require_store_endpoint() Try / catch
from semantic_kernel.exceptions import VectorStoreInitializationException
try:
store = AzureAISearchStore()
except VectorStoreInitializationException as e:
cause = e.__cause__ # pydantic ValidationError
for err in cause.errors():
print(err["loc"], err["msg"])
raise Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Failed to create Azure Cognitive Search settings.
- Error: missing Azure AI Search client credentials.
- OpenAI/Azure OpenAI configuration was not found.
- Could not find configuration section {caller}
- AI Chat Service type '{appConfig.RagConfig.AIChatService}' i
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/e0d83ff61eb0315e.
Report an issue: GitHub.