-
Notifications
You must be signed in to change notification settings - Fork 454
Document Azure OpenAI BYOK configuration for Copilot workflows #45276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+173
−0
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
967dfdc
Initial plan
Copilot 50fa3dd
docs: add Azure OpenAI BYOK guide
Copilot 48223a3
docs: drop unrelated generated docs churn
Copilot 5415fd4
docs: clarify Azure smoke workflow references
Copilot 9e9286b
Merge branch 'main' into copilot/701202-opanai
pelikhan 8df42a0
chore: plan pr-finisher triage
Copilot 9299847
docs: address review feedback — forward references for WIRE_API and r…
Copilot 6f8ec01
Apply remaining changes
Copilot ec6cdb6
Merge remote-tracking branch 'origin/main' into copilot/701202-opanai
Copilot d336ca3
recompile: sync smoke-call-workflow.lock.yml with upstream main changes
Copilot f114105
Merge branch 'main' into copilot/701202-opanai
pelikhan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,162 @@ | ||
| --- | ||
| title: How to use Azure OpenAI with Copilot BYOK | ||
| description: Configure GitHub Agentic Workflows to route Copilot through Azure OpenAI using API keys or Microsoft Entra authentication. | ||
| sidebar: | ||
| order: 325 | ||
| --- | ||
|
|
||
| Azure OpenAI is supported in Copilot Bring Your Own Key (BYOK) mode. Use the | ||
| Azure OpenAI resource's OpenAI v1 endpoint, put provider credentials in | ||
| `engine.env`, and choose the wire model deliberately when Azure deployment names | ||
| do not match Azure model IDs. | ||
|
|
||
| ## Use the Azure OpenAI v1 endpoint | ||
|
|
||
| Set `COPILOT_PROVIDER_BASE_URL` to the Azure resource endpoint with the | ||
| `/openai/v1` suffix: | ||
|
|
||
| ```aw wrap | ||
| engine: | ||
| id: copilot | ||
| model: gpt-5.4-2026-03-05 | ||
| env: | ||
| COPILOT_PROVIDER_BASE_URL: https://RESOURCE.openai.azure.com/openai/v1 | ||
| ``` | ||
|
|
||
| Do not use the older `/openai/v1-preview` path unless the Azure resource | ||
| explicitly exposes it. The repository smoke workflows | ||
| `smoke-copilot-aoai-apikey.md` and `smoke-copilot-aoai-entra.md` both use the | ||
| v1 endpoint. | ||
|
|
||
| ## Choose the model name and deployment name | ||
|
|
||
| `engine.model` (compiled to `COPILOT_MODEL`) should name the Azure model ID that | ||
| the provider exposes from `GET /openai/v1/models`. For versioned GPT-5 models, | ||
| that is often a fully qualified name such as `gpt-5.4-2026-03-05`. | ||
|
|
||
| If the Azure deployment name is different, set `COPILOT_PROVIDER_MODEL_ID` to | ||
| the deployment name that Azure expects on the request body: | ||
|
|
||
| ```aw wrap | ||
| engine: | ||
| id: copilot | ||
| model: gpt-5.4-2026-03-05 | ||
| env: | ||
| COPILOT_PROVIDER_BASE_URL: https://RESOURCE.openai.azure.com/openai/v1 | ||
| COPILOT_PROVIDER_MODEL_ID: gpt-5.4 | ||
| ``` | ||
|
|
||
| This keeps the AWF proxy and Copilot CLI aligned on the selected model while | ||
| still sending the Azure deployment name upstream. | ||
|
|
||
| ## Configure API-key authentication | ||
|
|
||
| ```aw wrap | ||
| engine: | ||
| id: copilot | ||
| model: gpt-5.4-2026-03-05 | ||
| env: | ||
| COPILOT_PROVIDER_BASE_URL: https://RESOURCE.openai.azure.com/openai/v1 | ||
| COPILOT_PROVIDER_API_KEY: ${{ secrets.AZURE_OPENAI_API_KEY }} | ||
| COPILOT_PROVIDER_MODEL_ID: gpt-5.4 | ||
| COPILOT_PROVIDER_WIRE_API: responses | ||
|
|
||
| network: | ||
| allowed: | ||
| - defaults | ||
| - RESOURCE.openai.azure.com | ||
| ``` | ||
|
|
||
| `COPILOT_PROVIDER_WIRE_API: responses` is required for GPT-5 and o-series | ||
| models — see [Use the `responses` wire | ||
| API](#use-the-responses-wire-api-for-gpt-5-and-o-series-models) below for | ||
| details. | ||
|
|
||
| > [!IMPORTANT] | ||
| > Put Azure BYOK credentials in `engine.env`, not in top-level `secrets:`. The | ||
| > BYOK proxy only receives provider credentials from the engine environment. | ||
|
|
||
| ## Configure Microsoft Entra authentication | ||
|
|
||
| Use GitHub OIDC when the Azure resource trusts a federated identity: | ||
|
|
||
| ```aw wrap | ||
| permissions: | ||
| id-token: write | ||
|
|
||
| engine: | ||
| id: copilot | ||
| model: gpt-5.4-2026-03-05 | ||
| auth: | ||
| type: github-oidc | ||
| provider: azure | ||
| azure-tenant-id: <tenant-id> | ||
| azure-client-id: <client-id> | ||
| env: | ||
| COPILOT_PROVIDER_BASE_URL: https://RESOURCE.openai.azure.com/openai/v1 | ||
| COPILOT_PROVIDER_MODEL_ID: gpt-5.4 | ||
|
github-actions[bot] marked this conversation as resolved.
|
||
| COPILOT_PROVIDER_WIRE_API: responses | ||
|
|
||
| network: | ||
|
github-actions[bot] marked this conversation as resolved.
|
||
| allowed: | ||
| - defaults | ||
| - RESOURCE.openai.azure.com | ||
| - login.microsoftonline.com | ||
| ``` | ||
|
|
||
| `COPILOT_PROVIDER_WIRE_API: responses` is required for GPT-5 and o-series | ||
| models — see [Use the `responses` wire | ||
| API](#use-the-responses-wire-api-for-gpt-5-and-o-series-models) below for | ||
| details. | ||
|
|
||
| ## Use the `responses` wire API for GPT-5 and o-series models | ||
|
|
||
| The Copilot CLI defaults custom providers to the legacy `completions` wire API. | ||
| Azure GPT-5 and o-series deployments typically require the newer `responses` | ||
| wire API instead: | ||
|
|
||
| ```aw wrap | ||
| engine: | ||
| env: | ||
| COPILOT_PROVIDER_WIRE_API: responses | ||
| ``` | ||
|
|
||
| The repository smoke workflows `smoke-copilot-aoai-apikey.md` and | ||
| `smoke-copilot-aoai-entra.md` both use this setting. | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| If Azure works with direct `curl` requests but the AWF proxy returns | ||
| `model not found`, check these items first: | ||
|
|
||
| - Verify that `engine.model` matches a model returned by | ||
| `GET /openai/v1/models`. | ||
| - If Azure requires a different deployment name on the wire, set | ||
| `COPILOT_PROVIDER_MODEL_ID` to that deployment name. | ||
| - Keep `COPILOT_PROVIDER_BASE_URL` on the `/openai/v1` endpoint. | ||
| - Set `COPILOT_PROVIDER_WIRE_API: responses` for GPT-5 and o-series models. | ||
|
|
||
| If the proxy still rewrites the deployment name and Azure returns HTTP 404, | ||
| disable AWF model fallback for that workflow: | ||
|
|
||
| ```aw wrap | ||
| sandbox: | ||
| agent: | ||
| id: awf | ||
| model-fallback: false | ||
|
github-actions[bot] marked this conversation as resolved.
|
||
| ``` | ||
|
|
||
| ## Recompile after workflow edits | ||
|
|
||
| Azure BYOK settings live in workflow frontmatter. All workflow edits require a | ||
| recompile: | ||
|
|
||
| ```bash | ||
| gh aw compile .github/workflows/my-workflow.md --watch | ||
| ``` | ||
|
|
||
| ## Related documentation | ||
|
|
||
| - [AI Engines Reference](/gh-aw/reference/engines/#copilot-bring-your-own-key-byok-mode) | ||
| - [Network Configuration Guide](/gh-aw/guides/network-configuration/) | ||
| - [Sandbox Reference](/gh-aw/reference/sandbox/) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.