You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -366,6 +366,7 @@ Match the heading emojis, heading levels, and section ordering exactly. If a sec
366
366
367
367
- Use the `ApimRequests` and `ApimTesting` classes from `apimrequests.py` and `apimtesting.py` for all API testing and traffic generation in notebooks.
368
368
- Do not use the `requests` library directly for calling APIM endpoints.
369
+
-**Favour HTTP connection reuse.** When a notebook makes multiple HTTP calls to the same APIM gateway (e.g. a test matrix), create a single `requests.Session()` early and route all calls through it. This avoids repeated TCP+TLS handshakes, which can add 200-500 ms per request. Configure `session.verify` and `session.headers` once from `utils.get_endpoint()` and pass the session (or use it in helper functions) for OPTIONS, GET, and POST calls alike.
369
370
- Use `utils.get_endpoint(deployment, rg_name, apim_gateway_url)` to determine the correct endpoint URL, headers, and TLS verification flag based on the infrastructure type. `allow_insecure_tls` is returned as `True` only for Application Gateway infrastructures because they use a self-signed certificate; it defaults to `False` everywhere else.
370
371
- Example:
371
372
```python
@@ -396,6 +397,7 @@ Match the heading emojis, heading levels, and section ordering exactly. If a sec
396
397
- Only use apostrophe (U+0027) and quotes (U+0022), not left or right single or double quotation marks.
397
398
- Do not localize URLs (e.g. no "en-us" in links).
398
399
- Never use emoji variation selectors in Markdown. They are sneaky little things that can cause rendering and Markdown anchor link issues.
400
+
-**Markdown tables must be column-aligned.** Pad cell values with spaces so that every `|` delimiter in a column lines up vertically. Use the separator row (`---`, `:---:`, etc.) to establish column widths and align all subsequent rows to match. This applies to every Markdown file in the repository (READMEs, skills, instructions, etc.).
399
401
400
402
## Testing and Edge Cases
401
403
@@ -485,6 +487,17 @@ Check `docs/README.md` for local preview instructions and styling notes. The pag
485
487
```
486
488
- When executing KQL via `az rest` or `az monitor log-analytics query`, write the query body to a temporary JSON file and pass it with `--body @tempfile.json` to avoid shell pipe-character interpretation issues on Windows.
487
489
490
+
### Admin APIs (`/admin/`) Convention
491
+
492
+
Samples that require administrative or operational endpoints (cache loading, configuration reloads, health checks, etc.) must place them under an **`/admin/`** API path. This establishes a consistent, recognisable pattern across all APIM Samples.
493
+
494
+
-**API path**: `{api_prefix}admin` (e.g. `cors-admin`, `lb-admin`). The sample's `api_prefix` keeps admin APIs namespaced per sample.
495
+
-**Subscription required**: Always `True`. Admin APIs must never be publicly accessible without a subscription key.
496
+
-**Production security**: Subscription keys are a baseline gate but are shared secrets, not identity-based auth. Production deployments should layer JWT validation (`validate-azure-ad-token` or `validate-jwt`) on top of subscription keys. See the `authX` and `authX-pro` samples for implementation patterns.
497
+
-**Naming**: Use kebab-case operation paths that describe the action (e.g. `/load-cache`, `/clear-cache`, `/refresh-config`).
498
+
-**Tags**: Include the sample's tags so the admin API is grouped with its sibling APIs in the APIM portal.
499
+
-**Documentation**: The admin API's display name should start with the phase or sample context (e.g. `Phase 3 Admin`) so its purpose is clear in the APIM portal.
500
+
488
501
### API Management Policy XML Instructions
489
502
490
503
- Policies should use camelCase for all variable names.
|**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 Creator**| Adding a new sample, gathering missing sample metadata, scaffolding from `_TEMPLATE`, and updating README, website, slide deck, and compatibility artifacts |
80
80
81
81
### How to Use Skills
82
82
@@ -120,18 +120,19 @@ Skills provide templates, patterns, and step-by-step workflows.
Copy file name to clipboardExpand all lines: README.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -68,6 +68,7 @@ It's quick and easy to get started!
68
68
|[AuthX Pro][sample-authx-pro]| Authentication and role-based authorization in a mock product with multiple APIs and policy fragments. | All infrastructures |
69
69
|[Azure Maps][sample-azure-maps]| Proxying calls to Azure Maps with APIM policies. | All infrastructures |
70
70
|[Costing][sample-costing]| Track and allocate API costs per business unit using APIM subscriptions, Entra ID application tracking, and AI Gateway token/PTU tracking via Log Analytics and Cost Management. | All infrastructures |
71
+
|[Dynamic CORS][sample-dynamic-cors]| Dynamic per-API CORS origin validation using custom policy fragments and a maintainable origin mapping. | All infrastructures |
71
72
|[Egress Control][sample-egress-control]| Control APIM outbound internet traffic by routing it through a Network Virtual Appliance (NVA) in a hub/spoke topology. | appgw-apim, appgw-apim-pe |
72
73
|[General][sample-general]| Basic demo of APIM sample setup and policy usage. | All infrastructures |
73
74
|[Load Balancing][sample-load-balancing]| Priority and weighted load balancing across backends. | apim-aca, afd-apim-pe |
@@ -380,6 +381,7 @@ _For much more API Management content, please also check out [APIM Love](https:/
0 commit comments