From 70f796cd37194dee6c1a073e67c576a3cde50b9c Mon Sep 17 00:00:00 2001 From: sunbrye Date: Thu, 25 Jun 2026 13:10:16 -0700 Subject: [PATCH 1/5] Restructure azure-managed-identity for codetabs compatibility Move shared prose (prerequisites heading, usage description) outside details blocks. Each details block now contains only code, which allows the docs-internal normalization pipeline to convert them into codetabs correctly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- docs/setup/azure-managed-identity.md | 133 ++++++++++++++------------- 1 file changed, 70 insertions(+), 63 deletions(-) diff --git a/docs/setup/azure-managed-identity.md b/docs/setup/azure-managed-identity.md index bf90ed99c5..6e5c8598a2 100644 --- a/docs/setup/azure-managed-identity.md +++ b/docs/setup/azure-managed-identity.md @@ -29,20 +29,49 @@ sequenceDiagram ## Code samples +### Prerequisites + +Install the Azure Identity and Copilot SDK packages for your language: +
.NET -### Prerequisites - -Install the required packages: + ```bash dotnet add package GitHub.Copilot.SDK dotnet add package Azure.Core ``` +
+
+Python + + + +```bash +pip install github-copilot-sdk azure-identity +``` + +
+
+TypeScript + + + +```bash +npm install @github/copilot-sdk @azure/identity +``` + +
+ ### Basic usage +Get a token using `DefaultAzureCredential` and pass it as the `bearer_token` in your provider config: + +
+.NET + ```csharp @@ -76,20 +105,9 @@ Console.WriteLine(response?.Data.Content); ```
-
Python -### Prerequisites - -Install the required packages: - -```bash -pip install github-copilot-sdk azure-identity -``` - -### Basic usage - ```python @@ -133,9 +151,46 @@ async def main(): asyncio.run(main()) ``` +
+
+TypeScript + + + +```typescript +import { DefaultAzureCredential } from "@azure/identity"; +import { CopilotClient } from "@github/copilot-sdk"; + +const credential = new DefaultAzureCredential({ + requiredEnvVars: ["AZURE_TOKEN_CREDENTIALS"], +}); +const tokenResponse = await credential.getToken( + "https://ai.azure.com/.default" +); + +const client = new CopilotClient(); + +const session = await client.createSession({ + model: "gpt-5.5", + provider: { + type: "openai", + baseUrl: `${process.env.FOUNDRY_RESOURCE_URL}/openai/v1/`, + bearerToken: tokenResponse.token, + wireApi: "responses", + }, +}); + +const response = await session.sendAndWait({ prompt: "Hello!" }); +console.log(response?.data.content); + +await client.stop(); +``` + +
+ ### Token refresh for long-running applications -Bearer tokens expire (typically after ~1 hour). For servers or long-running agents, refresh the token before creating each session: +Bearer tokens expire (typically after ~1 hour). For servers or long-running agents, refresh the token before creating each session. The following Python example demonstrates this pattern: @@ -181,54 +236,6 @@ class ManagedIdentityCopilotAgent: return response.data.content if response else "" ``` - - -
-TypeScript - -### Prerequisites - -Install the required packages: - -```bash -npm install @github/copilot-sdk @azure/identity -``` - -### Basic usage - - - -```typescript -import { DefaultAzureCredential } from "@azure/identity"; -import { CopilotClient } from "@github/copilot-sdk"; - -const credential = new DefaultAzureCredential({ - requiredEnvVars: ["AZURE_TOKEN_CREDENTIALS"], -}); -const tokenResponse = await credential.getToken( - "https://ai.azure.com/.default" -); - -const client = new CopilotClient(); - -const session = await client.createSession({ - model: "gpt-5.5", - provider: { - type: "openai", - baseUrl: `${process.env.FOUNDRY_RESOURCE_URL}/openai/v1/`, - bearerToken: tokenResponse.token, - wireApi: "responses", - }, -}); - -const response = await session.sendAndWait({ prompt: "Hello!" }); -console.log(response?.data.content); - -await client.stop(); -``` - -
- ## Environment configuration | Variable | Description | Example | From b15e28533b545ec047faee14e27195f21eefc658 Mon Sep 17 00:00:00 2001 From: sunbrye Date: Thu, 25 Jun 2026 13:13:06 -0700 Subject: [PATCH 2/5] Add multi-language code examples guidance to docs style guide Document the correct format for
blocks so they convert cleanly to codetabs in the docs-internal normalization pipeline. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../instructions/docs-style.instructions.md | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/.github/instructions/docs-style.instructions.md b/.github/instructions/docs-style.instructions.md index 36ad720156..36abe44d7d 100644 --- a/.github/instructions/docs-style.instructions.md +++ b/.github/instructions/docs-style.instructions.md @@ -160,3 +160,67 @@ Body text here. * [Link text](./relative-path.md): short description ``` + +## Multi-language code examples + +When showing the same concept in multiple programming languages, use consecutive `
` blocks. The docs-internal normalization pipeline converts these into tabbed language switchers on docs.github.com. + +### Rules + +* **Only code inside `
` blocks.** Shared prose, headings, and explanations must go outside the blocks. Each block should contain only a code fence (and optionally a `` comment). +* **Blocks must be consecutive.** No content (headings, paragraphs) between `
` blocks in the same group. Blank lines between blocks are fine. +* **Use the exact `` format:** `LANGUAGE`. Supported labels: `.NET`, `Python`, `TypeScript`, `Go`, `Java`, `Rust`, `Node.js`, `Shell`. +* **Need 2+ blocks to form a group.** A single `
` block won't be converted and renders as raw HTML on docs.github.com. +* **Equal content across tabs.** Each tab should show the same concept in a different language. Language-specific extras should be a separate section outside the tabs. + +### Correct + +Shared prose goes above the group, then each `
` block contains only code: + +```markdown +Install the SDK: + +
+.NET + + + +```bash +dotnet add package GitHub.Copilot.SDK +``` + +
+
+Python + + + +```bash +pip install github-copilot-sdk +``` + +
+``` + +### Incorrect + +Do not put headings, prose, or multiple sections inside a `
` block: + +```markdown +
+Python + +### Prerequisites ← breaks TOC/anchors +Install the packages: ← prose belongs outside + +```bash +pip install github-copilot-sdk +``` + +### Basic usage ← multiple sections in one tab +```python +[code] +``` + +
+``` From 517f4ee2d6e045770011b3cc5ffe842b094ca191 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 25 Jun 2026 21:55:45 +0000 Subject: [PATCH 3/5] Fix prose wording and nested fences in style guide examples Co-authored-by: scottaddie <10702007+scottaddie@users.noreply.github.com> --- .github/instructions/docs-style.instructions.md | 8 ++++---- docs/setup/azure-managed-identity.md | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/instructions/docs-style.instructions.md b/.github/instructions/docs-style.instructions.md index 36abe44d7d..dc26a0a921 100644 --- a/.github/instructions/docs-style.instructions.md +++ b/.github/instructions/docs-style.instructions.md @@ -177,7 +177,7 @@ When showing the same concept in multiple programming languages, use consecutive Shared prose goes above the group, then each `
` block contains only code: -```markdown +~~~markdown Install the SDK:
@@ -200,13 +200,13 @@ pip install github-copilot-sdk ```
-``` +~~~ ### Incorrect Do not put headings, prose, or multiple sections inside a `
` block: -```markdown +~~~markdown
Python @@ -223,4 +223,4 @@ pip install github-copilot-sdk ```
-``` +~~~ diff --git a/docs/setup/azure-managed-identity.md b/docs/setup/azure-managed-identity.md index 6e5c8598a2..51ca0dc0be 100644 --- a/docs/setup/azure-managed-identity.md +++ b/docs/setup/azure-managed-identity.md @@ -67,7 +67,7 @@ npm install @github/copilot-sdk @azure/identity ### Basic usage -Get a token using `DefaultAzureCredential` and pass it as the `bearer_token` in your provider config: +Get a token using `DefaultAzureCredential` and pass it as the bearer token in your provider configuration:
.NET From 43ee271273ea96ac5ba87e9cbf1202bc02da27f5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 25 Jun 2026 22:03:51 +0000 Subject: [PATCH 4/5] Switch style guide examples back to code fences (4-backtick outer fence) Co-authored-by: scottaddie <10702007+scottaddie@users.noreply.github.com> --- .github/instructions/docs-style.instructions.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/instructions/docs-style.instructions.md b/.github/instructions/docs-style.instructions.md index dc26a0a921..658e4d1d55 100644 --- a/.github/instructions/docs-style.instructions.md +++ b/.github/instructions/docs-style.instructions.md @@ -177,7 +177,7 @@ When showing the same concept in multiple programming languages, use consecutive Shared prose goes above the group, then each `
` block contains only code: -~~~markdown +````markdown Install the SDK:
@@ -200,13 +200,13 @@ pip install github-copilot-sdk ```
-~~~ +```` ### Incorrect Do not put headings, prose, or multiple sections inside a `
` block: -~~~markdown +````markdown
Python @@ -223,4 +223,4 @@ pip install github-copilot-sdk ```
-~~~ +```` From 6fd1c8965ad303813019f8449a4adf6d7c5702e7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 25 Jun 2026 22:14:39 +0000 Subject: [PATCH 5/5] Use 3-backtick fences for style guide markdown examples Co-authored-by: scottaddie <10702007+scottaddie@users.noreply.github.com> --- .github/instructions/docs-style.instructions.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/instructions/docs-style.instructions.md b/.github/instructions/docs-style.instructions.md index 658e4d1d55..36abe44d7d 100644 --- a/.github/instructions/docs-style.instructions.md +++ b/.github/instructions/docs-style.instructions.md @@ -177,7 +177,7 @@ When showing the same concept in multiple programming languages, use consecutive Shared prose goes above the group, then each `
` block contains only code: -````markdown +```markdown Install the SDK:
@@ -200,13 +200,13 @@ pip install github-copilot-sdk ```
-```` +``` ### Incorrect Do not put headings, prose, or multiple sections inside a `
` block: -````markdown +```markdown
Python @@ -223,4 +223,4 @@ pip install github-copilot-sdk ```
-```` +```