API Management Guidelines
These requirements apply to every API deployed to the Rome APIM service.
API contract and ownership
- Every API MUST be imported from a version-controlled OpenAPI contract.
- 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.
- APIs MUST be deployed to the APIM instance for their environment. Cross- environment backends, identities, audiences, and named values are prohibited.
Policy inheritance
- API and operation policies MUST inherit the platform baseline with
<base />in every applicable policy section. - 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.
- Every protected operation MUST have an operation-policy mapping or an equivalent reviewed API-level authorization rule.
- An OpenAPI
securitydeclaration MUST NOT be treated as proof that an APIM role policy was deployed.
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 approved delegated permission. - Customer and advisor routes MUST use their defined issuer, audience, client, and role rules even when they share a backend.
- Product subscriptions and API keys MUST NOT replace Entra authentication or operation authorization.
APIM-to-backend authentication
- APIM MUST call protected Azure backends using an approved APIM user-assigned managed identity.
- The API 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
X-Tenant-Idand other trusted context headers MUST be overwritten by APIM; caller-supplied values must not be trusted.X-Transaction-IdMUST be preserved or generated and propagated for end-to-end correlation.X-AuthorizationMUST be treated as a bearer credential.- Original-token forwarding MUST be limited to approved BFF routes that need the user context and terminate that token.
- Domain APIs and workers MUST NOT depend on, store, log, replay, or propagate
X-Authorization. - New APIs SHOULD receive minimal validated context rather than the original caller token.
Routing, traffic, and caching
- Public paths and backend rewrites MUST be declared and tested per operation.
- 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, 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, 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, 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 security review, and retain global backend, outbound, and error policy unless an additional exception is approved.
- Webhook validation MUST fail closed when required signatures, validation tokens, shared state, tenant, subscription, timestamp, or replay context is missing, invalid, ambiguous, or unavailable.
- 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.
- Validation challenges, payload JWTs, shared state such as
clientState, 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.
The deployed pattern is 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, 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.
- 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.
Validation and lifecycle
- Deployment MUST test valid access and denials for missing token, wrong issuer, wrong audience, inactive tenant, missing role, 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.
- 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.