Learning resourcesReviewed · GitHub

Azure Managed Identity with BYOK for the GitHub Copilot SDK

This GitHub guide shows developers how to authenticate Copilot SDK apps to Microsoft Foundry with Azure identities, but it assumes the Azure resource and access are already configured. It provides bearer-token callbacks, environment settings and examples in .NET, Go, Java, Python, Rust and TypeScript.

Researched 24 Nov 2026

In short.

This GitHub guide helps developers connect the Copilot SDK to Microsoft Foundry through Azure identities, but it does not walk through provisioning the resource or granting access. It explains how an application supplies a callback that retrieves Microsoft Entra bearer tokens while Azure Identity handles caching and refresh timing. Six language examples cover session configuration and a simple prompt. Package compatibility, costs and redistribution rights are not established by the article. Nothing was executed, so runtime behavior remains unassessed.

Researched and written by an AI model and checked by a second AI model. How it works

Covers the complete selected documentation page at the exact supplied address, including all six language examples, installation snippets, authentication explanation, environment configuration and scenario guidance. Linked BYOK, GitHub OAuth, backend-services and Azure credential-chain pages are excluded. The supplied article contains no explicit license notice. No package source, diagram image contents or external documentation was assessed, and nothing was executed.

The overview

Identity

Azure Managed Identity with BYOK is a GitHub Docs implementation guide for the GitHub Copilot SDK. It teaches authentication to Microsoft Foundry models through an OpenAI-compatible endpoint using Microsoft Entra bearer tokens.

The source address is [https://docs.github.com/api/article/body?pathname=/en/copilot/how-tos/copilot-sdk/setup/azure-managed-identity]. The resource is documentation with embedded code examples; it is not a separately installable integration.

Assessment

The guide is useful for developers who already have an Azure authentication approach and need the specific Copilot SDK configuration that connects it to Foundry. Its strongest feature is showing the same token-provider pattern across six languages.

Beginners receive concrete examples but will need additional guidance for Azure resource creation and authorization. The article supports understanding the integration design; it does not establish successful execution, deployment reliability or compatibility with particular package versions.

Users

The stated use cases include Azure-hosted applications with Managed Identity, applications with an existing Microsoft Entra service principal, and local development authenticated through Azure CLI.

Developers using .NET, Go, Java, Python or TypeScript receive DefaultAzureCredential examples. Rust developers receive a separate credential-selection implementation. Teams seeking static API-key authentication or GitHub subscription authentication are directed to other guides.

Capabilities

The article demonstrates configuring a custom provider, attaching a bearer-token callback, creating a Copilot session, sending a prompt and obtaining a response. Its examples use provider type openai and wire API responses.

The environment guidance covers system-assigned and user-assigned Managed Identity, local developer credentials, service principals and workload identity. Kubernetes is mentioned as a workload-identity use case, but Kubernetes configuration is not demonstrated.

Using it

Requirements

The examples assume a Microsoft Foundry resource URL, a usable model identifier, Azure credentials and the relevant Copilot SDK and Azure Identity packages. The endpoint pattern is [https://<resource-name>.openai.azure.com/openai/v1/]. Required Azure role assignments and resource-provisioning steps are not specified.

The guide requires environment-specific credential selection through AZURE_TOKEN_CREDENTIALS. AZURE_CLIENT_ID optionally selects a user-assigned Managed Identity in the five DefaultAzureCredential languages. Minimum SDK versions, runtime versions and a compatibility matrix are not provided.

Mechanism

A bearer token is an access credential presented to the model endpoint. The application supplies a function that asks Azure Identity for a token scoped to [https://ai.azure.com/.default] and returns the token string to the Copilot SDK.

The Copilot SDK can invoke that callback when it needs a fresh token. According to the guide, Azure Identity manages token caching and refresh timing. The model endpoint accepts the resulting Microsoft Entra token without a static model API key.

Most examples use DefaultAzureCredential to select credentials for the environment. Rust explicitly chooses ManagedIdentityCredential when AZURE_TOKEN_CREDENTIALS equals ManagedIdentityCredential and otherwise uses DeveloperToolsCredential.

Setup

Install the packages shown for your language, set FOUNDRY_RESOURCE_URL to the Foundry resource's base URL, and configure AZURE_TOKEN_CREDENTIALS. The guide recommends ManagedIdentityCredential in Azure and dev or a developer-tool credential name such as AzureCliCredential locally. Local Azure CLI authentication uses az login.

Create the credential object and token callback, then configure the session with the Foundry URL followed by /openai/v1/, the callback and the responses wire API. The examples use the model string gpt-5.5; whether that identifier is available for a particular resource is unknown.

The .NET installation block lists GitHub.Copilot.SDK and Azure.Core, while its code also imports Azure.Identity. It does not explicitly include an Azure.Identity installation command. Resolve that dependency detail before treating the instructions as complete for your project.

Example

The Python example installs github-copilot-sdk and azure-identity, creates an asynchronous DefaultAzureCredential with require_envvar=True, and defines get_bearer_token to request the Azure AI scope. It reads FOUNDRY_RESOURCE_URL, removes any trailing slash and appends /openai/v1/.

It then starts CopilotClient, creates a session with the callback and responses wire API, sends a greeting, prints the returned content and closes the client and credential. These are the documented steps; no resulting response or successful execution was observed.

The Python session also uses PermissionHandler.approve_all. This broadly approves session permission requests and is separate from Azure authentication. Applications should choose permission handling deliberately before reusing that setting.

Assessment & evidence

Limitations

There is no walkthrough of Azure role assignment, model deployment, authentication troubleshooting or recovery from token-provider failures. The article provides no measurements of latency, throughput, reliability or model quality.

Rust requires particular attention: the guide identifies it as an exception to the AZURE_CLIENT_ID behavior described for the other languages. Its sample constructs ManagedIdentityCredential without showing user-assigned identity selection, so that configuration remains unresolved within the article.

Some supported credential choices can still involve secrets. The service-principal path lists AZURE_CLIENT_SECRET; avoiding a model API key does not mean every credential option is secret-free.

Reasoning

For an application already using Microsoft Entra authentication, the callback offers a direct way to reuse that identity approach for model access. Credential acquisition stays in Azure Identity, while the Copilot session receives the token through its provider configuration.

A practical benefit inferred from this design is less application responsibility for manually obtaining and refreshing tokens or retaining a static model API key. The article does not establish security guarantees or quantify any operational improvement.

Alternatives

For a non-Azure environment using a static API key, the article points to BYOK configuration at [https://docs.github.com/en/copilot/how-tos/copilot-sdk/auth/byok]. For users with a GitHub Copilot subscription, it recommends GitHub OAuth setup at [https://docs.github.com/en/copilot/how-tos/copilot-sdk/setup/github-oauth].

Within the Azure pattern, the documented credential choices include Managed Identity, local developer credentials, service principals and workload identity. The linked guides and credential-chain references were outside the supplied article, so their implementation details were not assessed.

Evidence

The evidence consists of the complete GitHub Docs article at [https://docs.github.com/api/article/body?pathname=/en/copilot/how-tos/copilot-sdk/setup/azure-managed-identity], including its explanation, six language examples, environment table and scenario recommendations.

The code describes intended usage but supplies no execution receipts, benchmark results or deployed application observations. Nothing was executed. Token acquisition, refresh behavior, authorization and response handling remain untested.

Access & freshness

Costs

The article supplies no model prices, Azure service charges, SDK pricing or worked cost examples. Total operating cost is unknown.

The absence of a static API key does not establish that model requests are free. The article also does not establish Copilot subscription requirements for this BYOK configuration.

Rights

The supplied article contains no explicit license or redistribution notice for its text or embedded samples. It also does not establish the license terms of the referenced packages or the service terms governing Foundry usage.

Permission to redistribute the article or samples is therefore unknown from this evidence. Public access to documentation does not itself establish those rights.

Freshness

The article was captured on 24 November 2026 at 09:36:57.152 UTC. Its publication date and last substantive update date are not stated in the supplied text.

The installation commands do not pin package versions, and the Java dependencies contain version placeholders. The gpt-5.5 model string is part of the examples, not evidence of availability for every Foundry resource. Compatibility with subsequently installed packages is unknown.

Actions

Before adopting the pattern, confirm your Foundry endpoint, available model identifier, required Azure access and SDK versions. Resolve the .NET dependency detail and, if relevant, Rust user-assigned identity configuration. Review the Python permission handler before incorporating that example.

Validate local authentication and an Azure-hosted request in your own environment, then examine token renewal and authorization-failure behavior. Establish applicable service costs and licensing terms separately. These are recommended next steps; none was performed here.

Evidence for this report

selected-page.txtselected · checked 2026-11-24