Skip to content
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
f1c6c07
Initial check-in
simonkurtz-MSFT Jun 2, 2026
6b24037
Improved APIM policies, testing, and reporting
simonkurtz-MSFT Jun 2, 2026
e0cdc5b
Merge branch 'main' into feature/add-inference-sample
simonkurtz-MSFT Jun 9, 2026
caea849
Intermittent checkin
simonkurtz-MSFT Jun 9, 2026
9815ba8
Update meta information
simonkurtz-MSFT Jun 9, 2026
66c36ee
Merge branch 'main' into feature/add-inference-sample
simonkurtz-MSFT Jun 9, 2026
023e97b
Clean up and test coverage increase
simonkurtz-MSFT Jun 9, 2026
a5f33fc
Fix mocks
simonkurtz-MSFT Jun 9, 2026
951c5bf
Merge branch 'main' into feature/add-inference-sample
simonkurtz-MSFT Jun 10, 2026
45dfb16
Merge branch 'main' into feature/add-inference-sample
simonkurtz-MSFT Jun 11, 2026
8cafa3d
Refactor inference-failover sample, add HTTP matrix
simonkurtz-MSFT Jun 11, 2026
26c70c0
Fix Markdown
simonkurtz-MSFT Jun 11, 2026
c519b0e
Refactor Markdown
simonkurtz-MSFT Jun 11, 2026
101ce55
Fix assertion
simonkurtz-MSFT Jun 11, 2026
9613384
Refine AI backend instructions
simonkurtz-MSFT Jun 11, 2026
e255515
Hone the circuit breaker setup
simonkurtz-MSFT Jun 11, 2026
cadb4a4
Fix tests
simonkurtz-MSFT Jun 11, 2026
d2e5fed
Format
simonkurtz-MSFT Jun 11, 2026
62948ee
Refine test output
simonkurtz-MSFT Jun 11, 2026
0b56218
Further refinement of APIM policy and reporting
simonkurtz-MSFT Jun 11, 2026
c4bba1b
Tweaking the sample
simonkurtz-MSFT Jun 12, 2026
4d50855
Fix padding
simonkurtz-MSFT Jun 12, 2026
e0d468f
Fix tests
simonkurtz-MSFT Jun 12, 2026
feb85ab
Fix error
simonkurtz-MSFT Jun 12, 2026
3034ae8
Merge branch 'main' into feature/add-inference-sample
simonkurtz-MSFT Jun 12, 2026
b84d0ba
Sample tweaks
simonkurtz-MSFT Jun 12, 2026
31580a0
Tweaks
simonkurtz-MSFT Jun 12, 2026
cfbea0e
Fix test
simonkurtz-MSFT Jun 13, 2026
e6521ef
Merge branch 'main' into feature/add-inference-sample
simonkurtz-MSFT Jun 15, 2026
9fdde52
Test updates
simonkurtz-MSFT Jun 15, 2026
a299e1f
Clean-up improvements
simonkurtz-MSFT Jun 15, 2026
65808c1
Update tests
simonkurtz-MSFT Jun 15, 2026
806269e
Update dependencies, revert index
simonkurtz-MSFT Jun 16, 2026
375864b
Move event hub flag up
simonkurtz-MSFT Jun 16, 2026
d96f835
Clean up
simonkurtz-MSFT Jun 16, 2026
06376dc
Intermittent check-in
simonkurtz-MSFT Jun 18, 2026
6cca44a
Update paths
simonkurtz-MSFT Jun 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/agents/apim-sample-publisher.agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,4 @@ Return a concise publish-readiness report with:
- **Updated**: source files changed during the publishing pass.
- **Architecture**: notebook/helper ownership decision, shared-boundary reuse, and any remaining mechanics intentionally kept visible.
- **Validated**: focused helper tests, coverage, combined checks, and SEO source checks when website content changed.
- **Remaining**: manual visual checks, live Azure scenarios, or unresolved blockers. State `None` when the sample is ready for review.
- **Remaining**: manual visual checks, live Azure scenarios, or unresolved blockers. State `None` when the sample is ready for review.
1 change: 1 addition & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -626,4 +626,5 @@ Samples that require administrative or operational endpoints (cache loading, con
- After moving KQL or policy XML files, check and update every notebook, Python helper, Bicep `loadTextContent()` call, test, script, and documentation reference that consumes them. Add or update tests for canonical-directory resolution, root-level fallback, explicit paths, auto-detected sample names, and missing files before considering the migration complete.
- Policies should use camelCase for all variable names.
- In policy expressions inside double-quoted XML attributes, escape embedded double quotes as `&quot;` (for example, `value="@((string)context.Variables[&quot;callerId&quot;])"`). Unescaped quotes make the XML malformed. Expressions in element text, such as `<value>@("text")</value>`, do not require this escaping.
- The `<backend>` section may contain only one direct child policy. When retrying a backend request, make `<retry>` the sole direct child of `<backend>` and place `<forward-request>` plus any per-attempt policies inside it. Move terminal fallback handling to `<on-error>` or `<outbound>` as appropriate. Do not add sibling policies such as `<base />` or `<choose>` alongside the backend `<retry>`; APIM rejects the policy during deployment.
- Policy expressions (`@(...)` and `@{...}`) may **only** reference .NET types and members on APIM's [allow-list](https://learn.microsoft.com/azure/api-management/api-management-policy-expressions#CLRTypes). Using anything outside the list (e.g. `System.Globalization.*`, `DateTime.TryParse`, `DateTime.ToUniversalTime`, `System.Text.Json`) causes a deploy-time `ValidationError: One or more fields contain incorrect values` with no further detail. Verify each type/member against the allow-list before writing the expression. See `.github/skills/apim-policies/SKILL.md` for common pitfalls and allowed replacements.
48 changes: 45 additions & 3 deletions .github/markdown.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,18 @@ This document provides standards for Markdown files in the APIM Samples reposito
- Never use typographic/curly quotes: `'` `'` `"` `"`
- Improves consistency across editors and platforms

### Blank Lines

- Use exactly one blank line between paragraphs and sections. Do not add multiple consecutive blank lines.
- Surround headings, tables, lists, and fenced code blocks with a blank line.
- Add a blank line between introductory text such as `**Windows:**` and the fenced code block that follows it.
- Keep a blank line between the final table row and any following HTML closing tag or paragraph.

### Markdown Tables
**Markdown tables must be column-aligned.** Pad cell values with spaces so that every `|` delimiter in a column lines up vertically.

Use one table style consistently within each table. Always include one space on both sides of each pipe delimiter, including separator rows. Never write compact separators such as `|---|---|`.

**Prefer aligned tables** for short values. Pad cell values with spaces so that every `|` delimiter in a column lines up vertically.

❌ **WRONG** — misaligned columns:
```markdown
Expand All @@ -73,6 +83,29 @@ This document provides standards for Markdown files in the APIM Samples reposito

Use the separator row (`---`, `:---:`, `---:`, etc.) to establish column widths, then align all subsequent rows to match.

**Use compact tables** for prose-heavy content when alignment would create very long lines. Keep spaces around every pipe delimiter and use the same compact style for the header, separator, and each row.

```markdown
| Name | Description |
| --- | --- |
| Simple API Management | Public API Management instance for learning and experimentation. |
| Private Link | Private ingress for security-focused scenarios. |
```

### Lists

- Surround lists with a blank line.
- Indent nested unordered list items consistently. Prefer two spaces for each nested level to satisfy `MD007`.
- Use `1.` for every item in ordered Markdown source. Markdown renderers calculate the visible numbering, and this satisfies the repository's `MD029` style.
- If an established formatter forces a different nested indentation style, use the smallest possible scoped markdownlint annotation and keep the list internally consistent.

### Inline HTML

- Prefer native Markdown syntax over inline HTML whenever Markdown can express the same result.
- Use Markdown image syntax instead of `<img>` tags.
- Use inline HTML only when it adds behavior Markdown does not provide, such as `<details>` disclosures.
- Add `<!-- markdownlint-disable-next-line MD033 -->` immediately before an intentional inline HTML opening tag. Keep the exception local.

### File Links

When referencing files or line numbers in documentation:
Expand Down Expand Up @@ -185,13 +218,14 @@ Structured guides for domain-specific tasks (Bicep, Python policies, sample crea
### Emphasis

- Use `**bold**` for emphasis and strong concepts
- Use `*italic*` for variables or placeholders
- Use `_italic_` for variables or placeholders to satisfy the repository's `MD049` style
- Use `code` (backticks) for symbols, filenames, and technical terms
- Use blockquotes `>` for notes, tips, and callouts

### Cross-References

- Use reference-style links at the bottom for multiple references to the same target
- Remove reference-style link definitions when their final usage is removed. Unused definitions fail `MD053`.
- Example:
```markdown
See the [setup guide][setup] and [troubleshooting][troubleshooting] pages.
Expand All @@ -216,11 +250,14 @@ Structured guides for domain-specific tasks (Bicep, Python policies, sample crea

- Provide meaningful `alt` text for all images and diagrams
- Alt text should describe the image purpose, not just say "screenshot" or "diagram"
- Use native Markdown image syntax instead of inline HTML: `![alt text](path/to/image.png "Optional title")`
- Example: `![Deployment workflow showing resource dependencies](images/deployment.png)`

### Code Blocks

- Use language tags for syntax highlighting: ` ```python `, ` ```bicep `, ` ```json `
- Use `text` for plain terminal output, menu choices, and other non-code examples
- Surround every fenced code block with blank lines
- Include enough context in code examples that they're self-explanatory

---
Expand All @@ -231,7 +268,12 @@ Structured guides for domain-specific tasks (Bicep, Python policies, sample crea
| --- | --- | --- |
| Markdownlint failure | Markdown does not meet the configured lint rules | Fix every reported violation and rerun markdownlint |
| Anchor links break | Emoji in heading + encoded in link | Remove emoji from link reference: `[text](#heading-only)` |
| Tables misaligned | Inconsistent column widths | Pad cells with spaces to align `\|` delimiters |
| Tables misaligned | Mixed table styles or missing spaces around pipes | Use one consistent aligned or compact style and write separator rows as `\| --- \| --- \|` |
| Sections run together | Missing or repeated blank lines | Use exactly one blank line around headings, tables, lists, and fences |
| Code fence warning | Missing fence language | Add the appropriate language, or use `text` for plain output |
| List indentation warning | Inconsistent nesting or ordered prefixes | Use two spaces per unordered nesting level and `1.` for ordered items |
| Inline HTML warning | HTML used where Markdown is sufficient | Prefer native Markdown; add a local `MD033` exception only for required HTML behavior |
| Unused reference warning | Link definition remains after its final usage was removed | Delete the unused reference definition |
| File links broken | Wrong path or encoded characters | Use relative paths, encode spaces: `My%20File.md` |
| Symbols not highlighted | Missing backticks | Wrap in backticks: `symbolName` |
| Line ending issues | Mixed CRLF/LF | Ensure all `.md` files use LF only |
Expand Down
23 changes: 23 additions & 0 deletions .github/skills/apim-policies/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,29 @@ Every APIM policy document follows this structure:

The `<base />` element inherits policies from parent scopes (Global → Product → API → Operation).

### Backend Section Cardinality (CRITICAL)

The `<backend>` section may contain only one direct child policy. APIM rejects a policy during deployment when `<backend>` contains sibling policies such as `<retry>` followed by `<choose>`, or `<base />` followed by `<retry>`.

When retrying a backend request, make `<retry>` the sole direct child of `<backend>` and place `<forward-request>` plus any policies that must execute on every attempt inside `<retry>`. Move terminal fallback handling to `<on-error>` or `<outbound>` as appropriate.

```xml
<backend>
<retry count="3" interval="1" first-fast-retry="true"
condition="@(context.Response.StatusCode == 429 || context.Response.StatusCode >= 500)">
<forward-request buffer-request-body="true" />
</retry>
</backend>
```

When a custom backend policy is not needed, keep `<base />` as the only direct child:

```xml
<backend>
<base />
</backend>
```

## Policy Categories Quick Reference

| Category | Common Policies | Section |
Expand Down
2 changes: 2 additions & 0 deletions .github/skills/sample-creator/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,8 @@ For samples with custom policies, create XML files under `samples/<sample-name>/
</policies>
```

The `<backend>` section may contain only one direct child policy. Keep `<base />` as the only child when inheriting backend behavior. When retrying, replace `<base />` with a single `<retry>` child, nest `<forward-request>` and any per-attempt policies inside `<retry>`, and move terminal fallback handling to `<on-error>` or `<outbound>` as appropriate.

Load policies in the notebook:

```python
Expand Down
4 changes: 1 addition & 3 deletions .vscode/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
## Fixing Pylance unresolved import warnings
# Fixing Pylance unresolved import warnings

Follow [this documentation][pylance-troubleshooting].



[pylance-troubleshooting]: https://github.com/microsoft/pylance-release/blob/main/TROUBLESHOOTING.md#unresolved-import-warnings
12 changes: 9 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ All repository contributions should treat accessibility as a first-class quality
│ ├── costing/ # APIM costing and showback
│ ├── egress-control/ # Egress control via NVA routing
│ ├── general/ # Basic policy demonstrations
│ ├── inference-failover/ # AOAI model failover with LLM telemetry
│ ├── load-balancing/ # Backend pool load balancing
│ ├── oauth-3rd-party/ # OAuth 3rd-party (Spotify example)
│ └── secure-blob-access/ # Valet key pattern for blob storage
Expand Down Expand Up @@ -82,9 +83,10 @@ Use these skills for specialized tasks. Skills are located in `.github/skills/`.

Use these custom agents for focused repository workflows. Agents are located in `.github/agents/`.

| Agent | When to Use |
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **APIM Sample Creator** | Adding a new sample, gathering missing sample metadata, scaffolding from `_TEMPLATE`, and updating README, website, slide deck, and compatibility artifacts |
| Agent | When to Use |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **APIM Sample Creator** | Adding a new sample, gathering missing sample metadata, scaffolding from `_TEMPLATE`, and updating README, website, slide deck, and compatibility artifacts |
| **APIM Sample Publisher** | Finalizing an implemented sample for review or release by synchronizing READMEs, website, SEO, slide deck, compatibility artifacts, and quality checks |

### How to Use Skills

Expand Down Expand Up @@ -123,6 +125,10 @@ Skills provide templates, patterns, and step-by-step workflows.
- Keep sample display names consistent across README tables, the website, the slide deck, and compatibility artifacts.
- If a broadly useful improvement is discovered while creating a sample, suggest updating `samples/_TEMPLATE` so future samples inherit it.

## Publishing a Sample

Use `.github/agents/apim-sample-publisher.agent.md` after sample implementation is ready for a final quality pass. The publisher agent checks the working-tree diff, synchronizes README, website, SEO metadata and structured data, slideshow, matrix, and compatibility-diagram surfaces, runs the applicable linting and unit tests, exports the presentation, and reports any manual or live-Azure verification that remains.

### Sample Naming Conventions

- **Folder**: kebab-case (e.g., `oauth-validation`, `rate-limiting`)
Expand Down
Loading