Skip to content

add-apim-api

Scaffold a new API in Azure API Management with Bicep infrastructure.

Collect from user or infer from context:

  • API name — display name and kebab-case identifier (e.g., speeches-api)
  • Backend URL — the upstream service endpoint
  • Path prefix — gateway path (e.g., /speeches)
  • Access — open (no subscription) or protected (subscription key required)
  • Operations — method, URL template, parameters per operation

If protected, determine whether backend needs an API key from Key Vault.

Done when: all five fields known.

Create in order:

  1. infra/modules/api-management/apis/{api-name}.bicep — API definition with CORS, rate limiting, caching policies
  2. infra/modules/api-management/operations/{api-name}-operations.bicep — operation definitions following naming conventions below

Follow patterns in references/bicep-patterns.md for Bicep structure.

If backend API key needed:

  • infra/modules/api-management/named-values/{api-name}-key.bicep — Key Vault reference
  • infra/modules/api-management/policies/{api-name}-policy.bicep — policy injecting the key

Done when: all files created and compile with az bicep build.

Update existing modules:

  1. infra/modules/api-management/api-management.bicep — add module references
  2. infra/modules/api-management/products/{product-name}.bicep — associate API with product (if applicable)
  3. infra/main.bicepparam — add Front Door route (if new path prefix)

Done when: az bicep build --file infra/main.bicep succeeds.


VerbUseExample
listcollectionlistMinistries, listConsultations
getsingle itemgetResponse, getCatalog
createnew itemcreateSubscription
updatemodifyupdateDocument
deleteremovedeleteComment

Rules:

  • English identifiers, lowerCamelCase
  • list + plural (listMinistries), get + singular (getResponse)
  • Never fetch or retrieve — use list or get