VSCode, Github Copilot, OpenCode Bring your own model & keys - dual authentication mode Keys & Entra + PRM#362
Merged
Conversation
Initial release, includes dual authentication mode (GitHub Copilot BYOK + Azure AD) and PRM discovery (RFC 9728) for interactive OAuth + ApiKey based authentication. Tested on OpenCode and GitHub Copilot, with a Foundry model deployed in Azure OpenAI Service. Tested using GPT5.4 and Kimi-K2.6
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Purpose
This pull request introduces a new lab, "GitHub Copilot BYOK → Foundry (MI swap)", which demonstrates how to govern GitHub Copilot's BYOK access to a private Azure AI Foundry model via Azure API Management (APIM) using an identity swap pattern. The lab provides both Entra ID (keyless) and API key authentication flows, implements per-user/subscription governance and metering, and includes resource clean-up steps. The main changes are grouped below.
Lab Documentation and Notebooks
README.mdfor the new lab, detailing architecture, authentication modes, FinOps reporting, and setup/cleanup instructions.clean-up-resources.ipynbnotebook to automate the removal of Azure resources and the Entra security group created during the lab.APIM Policy Implementations
entra-policy.xmlfor the Entra ID (keyless) flow, implementing developer authentication, group-based authorization via Microsoft Graph, per-user rate limiting and metering, managed-identity token swap, and RFC 9728 OAuth discovery support.apikey-policy.xmlfor the API key flow, mapping subscription identity to FinOps dimensions, enforcing per-subscription rate limiting and metering, and performing the managed-identity swap.Does this introduce a breaking change?
Pull Request Type
What kind of change does this Pull Request introduce?
How to Test
Get the code
Follow the instructions in the Notebook for deployment and testing
Other Information