Skip to content

[docs] Document Azure API Management hosting integration - #2083

Open
Eric Erhardt (eerhardt) wants to merge 1 commit into
release/17.0from
eerhardt-apim-hosting-integration-docs
Open

Eric Erhardt (eerhardt) wants to merge 1 commit into
release/17.0from
eerhardt-apim-hosting-integration-docs

Conversation

@eerhardt

Copy link
Copy Markdown
Member

Summary

Documents the Azure API Management (APIM) hosting integration (Aspire.Hosting.Azure.ApiManagement) added in microsoft/aspire#19664 for Aspire 17.0. This PR supersedes #2041 and consolidates the APIM docs into one folder of eight focused pages under integrations/cloud/azure/azure-api-management/:

  • Get started: package install, quickstart (workload routed through APIM), deploy-only behavior (omitted from aspire run, provisioned by aspire deploy), SKU/capacity table with validation, deployment outputs, ConfigureInfrastructure (C#-only), security considerations, current limitations.
  • APIs and operations: compute-targeted AddApi, standalone APIs and WithBackend, generated wildcard proxy operations, explicit operations, OpenAI-compatible APIs.
  • OpenAPI import: WithOpenApiDocument (file) and WithOpenApiEndpoint (deployed workload endpoint), format handling, one-source rule.
  • Backends and pools: HTTP/SOAP backends, managed identity, TLS validation, circuit breakers, Azure OpenAI / Foundry / Blob Storage backends, weighted and priority pools.
  • Policies and named values: inbound statements at service/API/operation scope, complete policy documents, policy fragments, literal / secret parameter / Key Vault-backed named values.
  • Products and subscriptions: products, approval, limits, subscriptions and keys.
  • Service configuration: user-assigned managed identity and role assignments, Application Insights and per-API diagnostics, custom domains, adopting an existing service with PublishAsExisting.
  • Networking: classic injection, v2 outbound integration, Premium v2 injection, Key Vault NSG rule, private Container Apps backends, private endpoints.

Other changes:

  • Adds an "Azure API Management" group to the Azure integrations sidebar (alphabetical, before Azure App Configuration; child items have no locale translations, matching neighboring Azure groups).
  • Adds an APIM entry to the "Service-specific requirements" section of the Azure Virtual Network page, because APIM private endpoints don't disable public network access like the other services described there.

What I took from #2041: the overall single-service framing and the quick-start idea. What I changed: the sidebar position (it was inserted before Application Insights), the identity model (main uses a user-assigned identity; the PR description's system-assigned identity is outdated), the experimental diagnostic (see assumptions), and every sample was rebuilt so it compiles.

Assumptions and notes

  • Experimental status: the APIM package types don't carry [Experimental]; the package ships as a prerelease. The virtual network APIs that APIM networking uses (AddAzureVirtualNetwork, AddPrivateEndpoint, WithInternalLoadBalancer) report ASPIREAZURE003, and the pages call that out where it applies.
  • AppHost language parity: every sample has synced aspire-lang tabs with TypeScript first. C#-only APIs (ConfigureInfrastructure, output references, the Identity property) have a note beside them. The TypeScript snippets use plain typescript fences (not twoslash) because the repo's generated TypeScript API data (13.6.0) doesn't include APIM.
  • AddProject<T>: it's marked obsolete in the 17.0 preview (use AddDotnetProject), but I kept AddProject<Projects.X> / addProject(...) in samples to match the other 700+ samples in the repo. Easy to flip if the 17.0 docs standardize on the new API.
  • Package not on NuGet yet: Aspire.Hosting.Azure.ApiManagement returns 404 on nuget.org, so the NuGet link on the Get started page won't resolve until the package ships. For the same reason I did not add an integration-docs.json mapping: aspire-integrations.json is generated from NuGet, and reconcileIntegrationDocs (covered by test:unit:structured-data) drops official-package mappings that aren't in the catalog. Add Aspire.Hosting.Azure.ApiManagement -> /integrations/cloud/azure/azure-api-management/azure-api-management-get-started/ once the package is published and in the catalog.
  • Unverifiable from source alone: exact APIM subscription key header/query names, how APIM combines API-level and product-level subscription settings (linked to Microsoft Learn rather than restated), the precise gatewayUrl host form, and circuit-breaker failover behavior beyond what the generated Bicep shows.
  • Did not touch the 17.0 what's-new page.

Third-party links and affiliations

None. New links go to learn.microsoft.com, nuget.org (Microsoft's own package), and aspire.dev pages.

Validation

Source verification (local harnesses outside the repo):

  • Read PR #19664 and the code on microsoft/aspire main (the package has only the PR's merge commit, so main matches the PR).
  • Generated the real TypeScript AppHost SDK for Aspire.Hosting.Azure.ApiManagement 17.0.0-preview.1.26554.22 (and AppContainers) with the Aspire CLI and compiled all 31 TypeScript snippets with npx tsc --noEmit: 0 errors.
  • Compiled all 31 C# snippets in an AppHost project against the same packages with dotnet build: 0 errors, 0 warnings (CS0618 for obsolete AddProject<T> and ASPIRE012 for the obsolete AppHost SDK are suppressed deliberately).
  • Ran aspire publish on a sample AppHost to confirm the generated Bicep (service name, backend names, proxy-{method} operations, outputs) and the run-mode vs publish-mode resource model.

Repo checks (run from src/frontend):

  • pnpm test:unit:structured-data: passed (5 files, 99 tests)
  • pnpm test:unit:twoslash-blocks: passed (2 tests)
  • pnpm test:unit:docs: passed (2 tests)
  • pnpm exec astro sync: passed (content collection frontmatter schema)
  • pnpm exec eslint config/sidebar/integrations.topics.ts --max-warnings 0: passed
  • pnpm check-data: passed
  • Script check of every internal link/anchor and SEO title/description length in the new pages: no problems
  • pnpm build was intentionally not run locally (CI runs it).

Add a set of pages that document the Aspire.Hosting.Azure.ApiManagement
hosting integration (microsoft/aspire#19664): get started, APIs and
operations, OpenAPI import, backends and pools, policies and named values,
products and subscriptions, service configuration, and networking. Add the
sidebar group and an APIM note to the Azure Virtual Network private endpoint
guidance.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved documentation issues include incomplete package installation instructions, an uncreated Key Vault secret in both examples, and inaccurate subnet restrictions and missing-file exception guidance.

5 open issues
What changed in this PR

Adds eight focused guides for the Azure API Management hosting integration in Aspire 17.0, covering setup through deployment and advanced configuration.

Changes:

  • Documents APIs, OpenAPI imports, backends, policies, products, and service configuration with TypeScript and C# examples.
  • Explains networking models, tier restrictions, and private-endpoint public-access behavior.
  • Adds sidebar navigation and links from the existing Azure Virtual Network guide.
File Description
src/​frontend/​src/​content/​docs/​integrations/​cloud/​azure/​azure-virtual-network.mdx Adds APIM-specific private-endpoint guidance.
src/​frontend/​src/​content/​docs/​integrations/​cloud/​azure/​azure-api-management/​azure-api-management-service.mdx Covers identity, diagnostics, domains, and existing services.
src/​frontend/​src/​content/​docs/​integrations/​cloud/​azure/​azure-api-management/​azure-api-management-products.mdx Documents products, subscriptions, and key retrieval.
src/​frontend/​src/​content/​docs/​integrations/​cloud/​azure/​azure-api-management/​azure-api-management-policies.mdx Explains policies, fragments, and named values.
src/​frontend/​src/​content/​docs/​integrations/​cloud/​azure/​azure-api-management/​azure-api-management-openapi.mdx Covers file and deployed-endpoint imports.
src/​frontend/​src/​content/​docs/​integrations/​cloud/​azure/​azure-api-management/​azure-api-management-networking.mdx Documents network integration, injection, and private endpoints.
src/​frontend/​src/​content/​docs/​integrations/​cloud/​azure/​azure-api-management/​azure-api-management-get-started.mdx Introduces installation, deployment, pricing tiers, and limitations.
src/​frontend/​src/​content/​docs/​integrations/​cloud/​azure/​azure-api-management/​azure-api-management-backends.mdx Covers backends, authentication, circuit breakers, and pools.
src/​frontend/​src/​content/​docs/​integrations/​cloud/​azure/​azure-api-management/​azure-api-management-apis.mdx Documents workload routing and API operations.
src/​frontend/​config/​sidebar/​integrations.topics.ts Adds the Azure API Management navigation group.

Review effort: Balanced


To access these types and APIs, add the [📦 Aspire.Hosting.Azure.ApiManagement](https://www.nuget.org/packages/Aspire.Hosting.Azure.ApiManagement) NuGet package to your AppHost project.

<InstallPackage packageName="Aspire.Hosting.Azure.ApiManagement" />

### Add a service and route a workload

Call `AddAzureApiManagement` to add the service, then call `AddApi` with a compute resource to publish that workload through the gateway:

The following rules apply to every model:

- Each APIM service needs a dedicated subnet. A subnet that one APIM service uses can't be used by another.
</TabItem>
</Tabs>

Aspire reads the file when it generates infrastructure for publish or deploy, not during `aspire run`. The file doesn't need to exist for local development. When you publish or deploy, the file must exist and contain non-whitespace content, or Aspire throws an `InvalidOperationException`.
Comment on lines +206 to +207
const vault = await builder.addAzureKeyVault("vault");
await apim.addKeyVaultNamedValue("shared-secret", vault, "shared-secret", {
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

Frontend HTML artifact ready

The latest frontend build uploaded the frontend-dist artifact for PR #2083. Use the VS Code button below to open this PR with GitHub Artifacts Explorer and browse the built HTML locally.

VS Code: Open PR #2083 artifacts

This comment updates automatically when a new frontend build artifact is uploaded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants