Skip to content

[OpenAI Connector] Enable defaultModel for Azure OpenAI connector to support APIM endpoints#253577

Merged
stephmilovic merged 9 commits intoelastic:mainfrom
stephmilovic:issue_253520_impl
Feb 26, 2026
Merged

[OpenAI Connector] Enable defaultModel for Azure OpenAI connector to support APIM endpoints#253577
stephmilovic merged 9 commits intoelastic:mainfrom
stephmilovic:issue_253520_impl

Conversation

@stephmilovic
Copy link
Copy Markdown
Contributor

@stephmilovic stephmilovic commented Feb 17, 2026

Summary

Resolves #253520

Caution

This PR follows the intermediary release process, and the schema changes will be introduced in #253575. Please do not merge this PR until the week after #253575 is merged. The target merge date is February 23.

Azure API Management (APIM) and other proxy endpoints require the model field to be present in the request body. Unlike standard Azure OpenAI deployments, APIM endpoints cannot infer the model from the deployment URL, so requests without an explicit model field fail with "Model could not be detected". This PR wires up the defaultModel config field (accepted by the schema since the prerequisite PR) so that it is injected into outbound request bodies when the body does not already specify one, fixing both the connector test flow and the Observability AI Assistant runtime.

Manual testing steps

Prerequisites: an Azure API Management endpoint that requires model in the request body (reproduces the customer scenario).

  1. Navigate to Stack Management > Connectors > Create connector > OpenAI.
  2. Select "Azure OpenAI" as the provider.
  3. Confirm a new optional "Default model" field is visible in the form.
  4. Enter your APIM endpoint URL and API key. Leave "Default model" empty. Click "Test". Confirm the request body shown in the test panel does not include a model field (existing behavior unchanged).
  5. Enter a model name (e.g. gpt-4o) in the "Default model" field. Click "Test". Confirm the request body now includes "model": "gpt-4o" and the test succeeds against the APIM endpoint.
  6. In the test body editor, manually set "model": "gpt-3.5-turbo". Click "Test". Confirm the manually specified model is used and defaultModel does not override it.
  7. Save the connector. Open the Observability AI Assistant and select this connector. Send a message. Confirm the assistant responds successfully (previously this would fail with "Model could not be detected").
  8. Repeat steps 1-4 with a standard Azure OpenAI deployment URL (no APIM). Leave "Default model" empty. Confirm no regression — the connector still works without a model in the body.

@stephmilovic stephmilovic added release_note:fix Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. backport:version Backport to applied version labels v9.4.0 v9.2.5 v9.3.1 v8.19.12 labels Feb 17, 2026
@stephmilovic stephmilovic marked this pull request as ready for review February 23, 2026 18:10
@stephmilovic stephmilovic requested review from a team as code owners February 23, 2026 18:10
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

Copy link
Copy Markdown
Contributor

@pmuellr pmuellr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ResponseOps changes LGTM

@stephmilovic
Copy link
Copy Markdown
Contributor Author

@elasticmachine merge upstream

Copy link
Copy Markdown
Member

@spong spong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pair reviewed and confirmed fix -- thanks for getting this fix in @stephmilovic! 🙌

@elasticmachine
Copy link
Copy Markdown
Contributor

💔 Build Failed

Failed CI Steps

Metrics [docs]

‼️ ERROR: no builds found for mergeBase sha [ce4ae8a]

History

@stephmilovic stephmilovic merged commit fdbc8b7 into elastic:main Feb 26, 2026
16 checks passed
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 8.19, 9.2, 9.3

https://github.com/elastic/kibana/actions/runs/22460388800

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Feb 26, 2026
…o support APIM endpoints (elastic#253577)

(cherry picked from commit fdbc8b7)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Feb 26, 2026
…o support APIM endpoints (elastic#253577)

(cherry picked from commit fdbc8b7)
@kibanamachine
Copy link
Copy Markdown
Contributor

💔 Some backports could not be created

Status Branch Result
8.19 Backport failed because of merge conflicts
9.2
9.3

Note: Successful backport PRs will be merged automatically after passing CI.

Manual backport

To create the backport manually run:

node scripts/backport --pr 253577

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Feb 26, 2026
…ctor to support APIM endpoints (#253577) (#255185)

# Backport

This will backport the following commits from `main` to `9.3`:
- [[OpenAI Connector] Enable `defaultModel` for Azure OpenAI connector
to support APIM endpoints
(#253577)](#253577)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Steph
Milovic","email":"stephanie.milovic@elastic.co"},"sourceCommit":{"committedDate":"2026-02-26T20:42:24Z","message":"[OpenAI
Connector] Enable `defaultModel` for Azure OpenAI connector to support
APIM endpoints
(#253577)","sha":"fdbc8b78479fa90d96b51f713b9127f50a47b875","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:
SecuritySolution","backport:version","v9.4.0","v9.2.5","v9.3.1","v8.19.12"],"title":"[OpenAI
Connector] Enable `defaultModel` for Azure OpenAI connector to support
APIM
endpoints","number":253577,"url":"https://github.com/elastic/kibana/pull/253577","mergeCommit":{"message":"[OpenAI
Connector] Enable `defaultModel` for Azure OpenAI connector to support
APIM endpoints
(#253577)","sha":"fdbc8b78479fa90d96b51f713b9127f50a47b875"}},"sourceBranch":"main","suggestedTargetBranches":["9.2","9.3","8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/253577","number":253577,"mergeCommit":{"message":"[OpenAI
Connector] Enable `defaultModel` for Azure OpenAI connector to support
APIM endpoints
(#253577)","sha":"fdbc8b78479fa90d96b51f713b9127f50a47b875"}},{"branch":"9.2","label":"v9.2.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.3","label":"v9.3.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.12","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co>
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Mar 2, 2026
@kibanamachine
Copy link
Copy Markdown
Contributor

Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync.
cc: @stephmilovic

stephmilovic added a commit to stephmilovic/kibana that referenced this pull request Mar 2, 2026
…o support APIM endpoints (elastic#253577)

(cherry picked from commit fdbc8b7)

# Conflicts:
#	x-pack/platform/plugins/shared/stack_connectors/public/connector_types/openai/constants.tsx
@stephmilovic
Copy link
Copy Markdown
Contributor Author

💚 All backports created successfully

Status Branch Result
8.19

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Mar 2, 2026
…ctor to support APIM endpoints (#253577) (#255184)

# Backport

This will backport the following commits from `main` to `9.2`:
- [[OpenAI Connector] Enable `defaultModel` for Azure OpenAI connector
to support APIM endpoints
(#253577)](#253577)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Steph
Milovic","email":"stephanie.milovic@elastic.co"},"sourceCommit":{"committedDate":"2026-02-26T20:42:24Z","message":"[OpenAI
Connector] Enable `defaultModel` for Azure OpenAI connector to support
APIM endpoints
(#253577)","sha":"fdbc8b78479fa90d96b51f713b9127f50a47b875","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:
SecuritySolution","backport:version","v9.4.0","v9.2.5","v9.3.1","v8.19.12"],"title":"[OpenAI
Connector] Enable `defaultModel` for Azure OpenAI connector to support
APIM
endpoints","number":253577,"url":"https://github.com/elastic/kibana/pull/253577","mergeCommit":{"message":"[OpenAI
Connector] Enable `defaultModel` for Azure OpenAI connector to support
APIM endpoints
(#253577)","sha":"fdbc8b78479fa90d96b51f713b9127f50a47b875"}},"sourceBranch":"main","suggestedTargetBranches":["9.2","9.3","8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/253577","number":253577,"mergeCommit":{"message":"[OpenAI
Connector] Enable `defaultModel` for Azure OpenAI connector to support
APIM endpoints
(#253577)","sha":"fdbc8b78479fa90d96b51f713b9127f50a47b875"}},{"branch":"9.2","label":"v9.2.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.3","label":"v9.3.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.19","label":"v8.19.12","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co>
@kibanamachine
Copy link
Copy Markdown
Contributor

Looks like this PR has backport PRs but they still haven't been merged. Please merge them ASAP to keep the branches relatively in sync.
cc: @stephmilovic

stephmilovic added a commit that referenced this pull request Mar 3, 2026
…ector to support APIM endpoints (#253577) (#255600)

# Backport

This will backport the following commits from `main` to `8.19`:
- [[OpenAI Connector] Enable `defaultModel` for Azure OpenAI connector
to support APIM endpoints
(#253577)](#253577)

<!--- Backport version: 10.2.0 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Steph
Milovic","email":"stephanie.milovic@elastic.co"},"sourceCommit":{"committedDate":"2026-02-26T20:42:24Z","message":"[OpenAI
Connector] Enable `defaultModel` for Azure OpenAI connector to support
APIM endpoints
(#253577)","sha":"fdbc8b78479fa90d96b51f713b9127f50a47b875","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","backport
missing","Team:
SecuritySolution","backport:version","v9.4.0","v9.2.5","v9.3.1","v8.19.12"],"title":"[OpenAI
Connector] Enable `defaultModel` for Azure OpenAI connector to support
APIM
endpoints","number":253577,"url":"https://github.com/elastic/kibana/pull/253577","mergeCommit":{"message":"[OpenAI
Connector] Enable `defaultModel` for Azure OpenAI connector to support
APIM endpoints
(#253577)","sha":"fdbc8b78479fa90d96b51f713b9127f50a47b875"}},"sourceBranch":"main","suggestedTargetBranches":["8.19"],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/253577","number":253577,"mergeCommit":{"message":"[OpenAI
Connector] Enable `defaultModel` for Azure OpenAI connector to support
APIM endpoints
(#253577)","sha":"fdbc8b78479fa90d96b51f713b9127f50a47b875"}},{"branch":"9.2","label":"v9.2.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/255184","number":255184,"state":"OPEN"},{"branch":"9.3","label":"v9.3.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/255185","number":255185,"state":"MERGED","mergeCommit":{"sha":"c032f32bdf161d581f5885cca32ceed11ae32fa0","message":"[9.3]
[OpenAI Connector] Enable `defaultModel` for Azure OpenAI connector to
support APIM endpoints (#253577) (#255185)\n\n# Backport\n\nThis will
backport the following commits from `main` to `9.3`:\n- [[OpenAI
Connector] Enable `defaultModel` for Azure OpenAI connector\nto support
APIM
endpoints\n(#253577)](https://github.com/elastic/kibana/pull/253577)\n\n\n\n###
Questions ?\nPlease refer to the [Backport
tool\ndocumentation](https://github.com/sorenlouv/backport)\n\n\n\nCo-authored-by:
Steph Milovic
<stephanie.milovic@elastic.co>"}},{"branch":"8.19","label":"v8.19.12","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
@kibanamachine kibanamachine added v8.19.13 and removed backport missing Added to PRs automatically when the are determined to be missing a backport. labels Mar 3, 2026
qn895 pushed a commit to qn895/kibana that referenced this pull request Mar 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels release_note:fix Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v8.19.12 v8.19.13 v9.2.5 v9.2.7 v9.3.1 v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Azure OpenAI Connector] Assistant fails with Azure APIM chat completions when model is required in request body

6 participants