{"record":{"id":"9bcff421431a7e67","repo":"microsoft/semantic-kernel","slug":"please-provide-an-azure-openai-endpoint","errorCode":null,"errorMessage":"Please provide an Azure OpenAI endpoint","messagePattern":"Please provide an Azure OpenAI endpoint","errorType":"exception","errorClass":"AgentInitializationException","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/agents/open_ai/azure_assistant_agent.py","lineNumber":124,"sourceCode":"            and credential\n        ):\n            ad_token = get_entra_auth_token(credential, azure_openai_settings.token_endpoint)\n\n        # If we still have no credentials, we can't proceed\n        if not azure_openai_settings.api_key and not ad_token and not ad_token_provider and not credential:\n            raise AgentInitializationException(\n                \"Please provide either an api_key, ad_token, ad_token_provider or credential for authentication.\"\n            )\n\n        merged_headers = dict(copy(default_headers)) if default_headers else {}\n        if default_headers:\n            merged_headers.update(default_headers)\n        if APP_INFO:\n            merged_headers.update(APP_INFO)\n            merged_headers = prepend_semantic_kernel_to_user_agent(merged_headers)\n\n        if not azure_openai_settings.endpoint:\n            raise AgentInitializationException(\"Please provide an Azure OpenAI endpoint\")\n\n        if not azure_openai_settings.chat_deployment_name:\n            raise AgentInitializationException(\"Please provide an Azure OpenAI deployment name\")\n\n        client = AsyncAzureOpenAI(\n            azure_endpoint=str(azure_openai_settings.endpoint),\n            api_version=azure_openai_settings.api_version,\n            api_key=azure_openai_settings.api_key.get_secret_value() if azure_openai_settings.api_key else None,\n            azure_ad_token=ad_token,\n            azure_ad_token_provider=ad_token_provider,\n            default_headers=merged_headers,\n            **kwargs,\n        )\n\n        return client, azure_openai_settings.chat_deployment_name\n\n    @staticmethod\n    def create_client(","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/agents/open_ai/azure_assistant_agent.py#L106-L142","documentation":"After auth is resolved, the factory checks that azure_openai_settings.endpoint is set. An empty/None endpoint makes it impossible to build the AsyncAzureOpenAI client, so AgentInitializationException(\"Please provide an Azure OpenAI endpoint\") is raised.","triggerScenarios":"Instantiating the Azure assistant without AZURE_OPENAI_ENDPOINT in the environment/args and without an endpoint= argument, or with base_url configured instead of endpoint (Azure requires the deployment endpoint).","commonSituations":"Missing AZURE_OPENAI_ENDPOINT env var; using base_url-style config (non-Azure) by mistake; endpoint var typo or in a different .env than env_file_path points to.","solutions":["Set AZURE_OPENAI_ENDPOINT (e.g. https://<resource>.openai.azure.com/) in env or .env, or pass endpoint= explicitly.","Confirm env_file_path loads the file containing AZURE_OPENAI_ENDPOINT.","Use the Azure endpoint form (not a base_url) when targeting Azure OpenAI."],"exampleFix":"// before\nAzureOpenAIAssistantAgent(..., deployment_name=dep, api_key=k)  # no endpoint\n# -> Please provide an Azure OpenAI endpoint\n\n// after\nAzureOpenAIAssistantAgent(\n    ..., deployment_name=dep, api_key=k,\n    endpoint=\"https://myresource.openai.azure.com/\",\n)","handlingStrategy":"validation","validationCode":"def has_endpoint(settings) -> bool:\n    return bool(settings.endpoint)","typeGuard":"def has_azure_endpoint(settings) -> bool:\n    return getattr(settings, 'endpoint', None) not in (None, \"\")","tryCatchPattern":null,"preventionTips":["Set AZURE_OPENAI_ENDPOINT to the https://<resource>.openai.azure.com/ form.","Confirm env_file_path loads the file containing the endpoint.","Use the Azure endpoint, not a base_url."],"tags":["azure","config","initialization","endpoint","agentinit"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}