{"record":{"id":"57df5d1668aafc90","repo":"microsoft/semantic-kernel","slug":"please-provide-an-azure-openai-endpoint-57df5d","errorCode":null,"errorMessage":"Please provide an Azure OpenAI endpoint","messagePattern":"Please provide an Azure OpenAI endpoint","errorType":"exception","errorClass":"AgentInitializationException","httpStatus":null,"severity":"critical","filePath":"python/semantic_kernel/agents/open_ai/azure_responses_agent.py","lineNumber":131,"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.responses_deployment_name:\n            raise AgentInitializationException(\"Please provide an Azure OpenAI Responses 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.responses_deployment_name\n\n    @staticmethod\n    def create_client(","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/agents/open_ai/azure_responses_agent.py#L113-L149","documentation":"Raised by AzureResponsesAgent's client builder when AzureOpenAISettings.endpoint is unset. The AsyncAzureOpenAI client requires an azure_endpoint to route requests, so an empty endpoint blocks client creation entirely.","triggerScenarios":"Constructing AzureResponsesAgent without AZURE_OPENAI_ENDPOINT and without passing endpoint (and no usable base_url that substitutes for it in this path). The check `if not azure_openai_settings.endpoint` triggers.","commonSituations":"Missing AZURE_OPENAI_ENDPOINT in the environment; wrong env_file_path so the .env is not loaded; using base_url-only configuration in a code path that still demands endpoint.","solutions":["Set AZURE_OPENAI_ENDPOINT to your resource URL (https://<resource>.openai.azure.com/).","Pass endpoint= explicitly to the AzureResponsesAgent constructor.","Verify the .env file is loaded (check env_file_path and that os.environ has the value).","Ensure the value is an HTTPS URL."],"exampleFix":"# before\nAzureResponsesAgent(deployment_name=\"resp-deploy\", api_key=\"...\")  # no endpoint\n# after\nAzureResponsesAgent(\n    endpoint=\"https://myresource.openai.azure.com/\",\n    deployment_name=\"resp-deploy\",\n    api_key=\"...\",\n)","handlingStrategy":"validation","validationCode":"from semantic_kernel.connectors.ai.open_ai.settings import AzureOpenAISettings\n\nsettings = AzureOpenAISettings()\nif not settings.endpoint:\n    raise SystemExit(\"AZURE_OPENAI_ENDPOINT is not set (e.g. https://<resource>.openai.azure.com/).\")\nif not str(settings.endpoint).startswith(\"https://\"):\n    raise SystemExit(\"AZURE_OPENAI_ENDPOINT must be an HTTPS URL.\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set AZURE_OPENAI_ENDPOINT as a full HTTPS URL.","Validate endpoint presence and scheme at startup.","Confirm env_file_path points at the .env that defines the endpoint."],"tags":["azure-openai","configuration","semantic-kernel","agents","endpoint","initialization"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}