API Management Guidelines
These requirements apply to every API deployed to the Rome APIM service. They carry forward the V2 guidelines and add the V3 product scope, capability, edge, and contract rules. Where the deployed platform does not yet comply, the gap ID is shown; the requirement still applies.
API contract and ownership
- Every API MUST be imported from a version-controlled OpenAPI 3.x contract and deployed through reviewed IaC.
- Every operation MUST have a stable, unique
operationIdused by Terraform and policy mapping. - The service team MUST own the OpenAPI contract, backend, API policy, operation policies, role requirements, diagnostics, tests, and retirement path.
- Production portal edits MUST NOT be the source of truth. Emergency changes MUST be reconciled to IaC immediately.
- APIs MUST be deployed to the APIM instance for their environment. Cross-environment backends, identities, audiences, and named values are prohibited.
- Breaking changes MUST use a new URI-path major version. Collection endpoints MUST use bounded opaque-cursor pagination. Errors MUST use a stable safe envelope with a code, message, optional details, and correlation ID.
- Long-running operations MUST return
202 Accepted,Location, and retry guidance rather than block the HTTP request (ADR-0020).
Edge and exposure
- Public API traffic MUST use the supported Front Door → Application Gateway → APIM path (ADR-0015).
- APIM MUST reject requests whose
X-Azure-FDIDdoes not match ION’s Front Door, except the public synthetic health operations. Not yet enforced globally (gap APIM-02); enforced on the Pigeon Twilio API. - APIM MUST NOT be used as a substitute for the Front Door WAF, BFF validation, or domain invariants.
Policy inheritance
- Product, API, and operation policies MUST inherit their parent with
<base />in every applicable policy section. - A product policy MUST call
<base />as its first inbound statement and MUST NOT modifyAuthorization,X-Authorization, orX-Tenant-Id. - Global and product policy changes MUST receive platform and security review (CODEOWNERS) because shared APIM creates a shared blast radius. This includes the MFE product policy implemented by the Signet team.
- A change that removes or repositions
<base />MUST receive security review because it changes policy order and can bypass inherited controls. - Service policy MUST NOT weaken global authentication, tenant validation, correlation, error handling, or diagnostics without an approved exception.
- Services MUST consume platform-owned fragments rather than copy global policy.
- Every protected operation MUST have an operation-policy mapping or an equivalent reviewed API-level authorization rule.
- An OpenAPI
securitydeclaration or a Terraformroles_csvvalue MUST NOT be treated as proof that an APIM role check was deployed. Gap APIM-05: Signet’s operation template ignoresroles_csv.
Caller authentication and authorization
- Protected routes MUST require a signed Microsoft Entra access token.
- APIM MUST validate token signature, validity, issuer policy, expected audience, tenant claim, and required claims before forwarding.
- Customer routes MUST verify that the customer tenant is active and onboarded. Failure or ambiguity MUST fail closed.
- Every protected operation MUST validate the required
Ion.*application role or, for end-user sign-in tokens, the user role or delegated sign-in scope defined by the route. A delegated permission MUST NOT substitute for a workload’s application role. - MFE BFF routes MUST be published under the MFE product, which validates the
capability token with Signet and the tenant or workspace path scope before
forwarding. Validation failure, timeout, or error MUST return
403. - A user token MUST be accepted only for the audience of the shell
application the user signed in to. MFE BFFs MUST bind the capability token
to that user token (
entra_aud,oid == sub, tenant in scope) rather than accept either token on its own. - Products and subscription keys MUST NOT replace Entra authentication or operation authorization.
- The BFF and domain service MUST perform their own authorization. APIM policy MUST NOT be treated as the only enforcement point.
APIM-to-backend authentication
- APIM MUST call protected Azure backends using an approved APIM user-assigned managed identity.
- Policy MUST acquire a token for the intended backend audience and override
the backend
Authorizationheader with that APIM token. - Backend Function Apps, App Services, Container Apps, Logic Apps, and equivalent HTTP compute MUST enforce Entra OAuth and reject anonymous direct access.
- Backend OAuth configuration MUST accept only the intended audience and approved APIM principal or application role.
- Managed-identity token acquisition failure MUST fail closed. Policy MUST NOT fall back to anonymous access, a shared secret, the caller token, or a more privileged identity.
- An operation that overrides its backend MUST retain equivalent managed- identity authentication.
Caller context
- APIM MUST override
X-Tenant-Id,X-Authorization,Forwarded, and other trusted context headers. Client-supplied values MUST NOT be appended, trusted, or reach a backend. Gap APIM-01:X-Authorizationusesexists-action="skip". - Until APIM-01 is closed, a backend MUST validate the signature, issuer,
audience, and expiry of any
X-Authorizationtoken it uses. X-Authorizationcarries the validated caller token. An API MAY replace it with APIM’s own token when no caller context is needed.X-AuthorizationMUST be treated as a bearer credential. BFFs and domain services MUST NOT store, log, replay, or propagate it.- User tokens MUST terminate at the BFF. Downstream calls MUST use managed identity and minimal validated context.
X-Transaction-IdMUST be preserved or generated and propagated for end-to-end correlation.
Routing, traffic, and caching
- Public paths and backend rewrites MUST be declared and tested per operation.
- Public and integration routes MUST have caller-appropriate rate limits keyed
on a stable caller dimension (user
oid, client application, tenant, or source IP for providers). Throttled requests MUST return429withRetry-After. - Rate-limit keys MUST isolate APIs and callers sufficiently to prevent one API or principal from consuming another’s allowance.
- Platform concurrency policy MUST protect one backend from exhausting APIM or neighboring services.
- Only safe, idempotent responses MAY be cached. Cache keys MUST include every tenant, customer, identity, capability, query, header, and representation dimension that changes the response.
- Customer-scoped responses MUST NOT be reusable across customers.
- Mutations, credentials, authorization failures, and error responses MUST NOT be cached.
Named values and credentials
- Environment-specific audiences, client identifiers, tenant settings, the Front Door ID, URLs, and durations MUST use controlled named values or deployment variables rather than hard-coded policy values.
- Secrets MUST be Key Vault-backed where APIM requires secret configuration.
- Tenant IDs, application IDs, managed-identity IDs, Front Door IDs, credentials, and production endpoint values MUST NOT be copied into architecture or example policies.
- Azure-hosted services MUST NOT introduce client secrets or certificates as a substitute for managed identity.
External-provider webhooks
- A webhook API MAY bypass global inbound Entra policy only when the provider cannot present an ION token and a documented provider-specific validation protocol is enforced by the API or backend.
- Every bypass MUST use a dedicated API or operation, receive platform and security review, and retain global backend, outbound, and error policy unless an additional exception is approved.
- A webhook API reached through the edge MUST check
X-Azure-FDIDat API scope. - Webhook validation MUST fail closed when required signatures, validation tokens, shared state, tenant, subscription, timestamp, or replay context is missing, invalid, ambiguous, or unavailable.
- Signature validation that depends on the external URL MUST rebuild it only from forwarding headers set by the trusted edge.
- APIM MUST authenticate to the webhook backend using an approved UAMI, and the backend MUST reject anonymous direct access through platform OAuth.
- Source-IP filtering and rate limits MUST NOT replace provider-level sender validation.
- Webhook and other unauthenticated APIs MUST NOT include body-logging
fragments such as
fragment-request-trace, or MUST use a redacting variant. Gap APIM-03. - Validation challenges, payload JWTs, signatures, shared state such as
clientState, provider secrets, and webhook bodies MUST NOT be logged. - The OpenAPI security declaration MUST describe the effective webhook trust model and MUST NOT claim bearer-token enforcement that APIM does not perform.
- Webhook handlers MUST handle provider retries idempotently where applicable.
The deployed patterns are documented in Webhook flow implementation.
Health endpoints
- Authentication bypass for synthetic probes MUST be limited to explicitly named public synthetic health operations.
- Public health responses MUST NOT expose customer data, configuration, identities, dependency details, or exception content.
- A synthetic APIM health response MUST NOT be represented as backend or end-to-end readiness.
- Authenticated health operations MUST inherit normal token and role policy.
Diagnostics and privacy
- Logs MUST include correlation, API, operation, status, duration, and bounded authorization outcome needed for support and security monitoring.
Authorization,X-Authorization,X-Capabilities, raw access tokens, signing material, secrets, authorization codes, and complete JWT payloads MUST NOT be logged.- Request and response bodies MUST NOT be traced by default. Any exception requires data classification, field-level redaction, access control, retention, and security approval. Gap APIM-03.
- Email, subject, object ID, tenant ID, and roles MUST be collected only when necessary and protected according to their classification.
- Diagnostic sampling, destination, access, and retention MUST be declared and reproducible.
- Operational notifications such as autoscale events MUST go to owned team channels, not personal mailboxes. Gap APIM-04.
- Policy failures MUST return safe errors and retain enough internal detail for diagnosis without disclosing validation internals to callers.
Validation and lifecycle
- Deployment MUST test valid access and denials for missing token, wrong
issuer, wrong audience, inactive tenant, missing role, invalid capability,
injected
X-Authorization, missingX-Azure-FDIDwhere enforced, backend-token failure, direct backend access, and cross-customer requests where applicable. - The deployed operation inventory MUST be reconciled with OpenAPI and the Terraform operation-policy map.
- Old major versions SHOULD publish deprecation and sunset information and MUST remain until consumers have completed an agreed migration.
- Emergency response MUST support route blocking, role removal, APIM identity revocation, backend allow-list removal, or workload shutdown as appropriate.
- API retirement MUST remove routes, policies, product association, diagnostics, backend role grants, named values used only by that API, and stale DNS or edge configuration.
Implementation procedures and XML examples are in the API Management implementation guide.