APIM Service Onboarding
A service team owns the contract and APIM overlays for its service. The pattern
is unchanged from V2: OpenAPI import, product association, API policy,
operation-policy map, and API diagnostics are deployed from the service
repository to the shared Rome APIM instance. Signet
(signet/infrastructure-shared/main-apim.tf) and Pigeon
(pigeon/infrastructure/main-twilio-webhooks-apim.tf) are current V3 examples.
Required artifacts
<service>/
├── api/<service>.yaml
└── infrastructure-shared/
├── main-apim.tf
├── policies/apim-api-policy.xml
├── policies/apim-api-operation.xml
└── modules/apim/
Paths may vary, but ownership and deployed resources must remain explicit.
Choose the API category
| Category | Product | Extra onboarding steps |
|---|---|---|
| MFE BFF API | apim-product-mfe-{env}-{reg}-01 | Step 5: tenant or workspace path naming, capability test cases |
| Role-based API (UI or platform service) | Service product | None beyond the standard steps |
| Integration ingress API | Service product | Integration application role and caller allow-list |
| Provider webhook | Dedicated webhook product | Follow Webhook flow implementation instead of steps 4–6 |
Step-by-step implementation
Define the API and security contract
Owner: Service team
Define each method, path, request, response, error, and stable operationId in
OpenAPI. Document the intended security requirement, but remember that OpenAPI
does not deploy APIM role enforcement by itself. Contract rules for versioning,
pagination, errors, and async operations are in API contracts and
async.
paths:
/v1/tenants/{tenantId}/workspaces/{workspaceId}/summary:
get:
operationId: get-workspace-summary-v1
summary: Get a workspace summary
responses:
'200':
description: Successful response
'401':
description: Authentication failed
'403':
description: Authorization failedImport the OpenAPI contract and associate the product
Owner: Service team
Use the approved API module to import the specification, define the gateway path, and associate the API with its product.
module "apim_api" {
source = "<approved-api-management-api-module>"
apim_product_id = local.apim_product_id
api_resource_name = local.apim_api_name
api_display_name = local.apim_api_display_name
service_name = local.service_name
resource_group_name = local.apim_resource_group_name
api_specification = "../api/service.yaml"
api_path = "service-int"
apim_name = local.apim_name
}The product groups the API and, for the MFE product, applies the capability policy. It is not a substitute for Entra tokens and roles. Subscription keys are not used.
Protect the backend with OAuth
Owner: Service team
Enable platform authentication on the Function App, App Service, Container App, Logic App, or other HTTP compute endpoint. Configure the expected audience and allow the selected APIM managed identity or backend application role. See App Service authentication.
Before continuing, prove that:
- an anonymous direct request is rejected;
- a token for another audience is rejected; and
- the approved APIM principal can authenticate.
Apply the API policy
Owner: Service team
Set the backend, rate limit, APIM managed identity, and outbound sanitization at
API scope. Keep <base /> so the service inherits global caller validation,
any product policy, and backend forwarding.
module "apim_api_policy" {
depends_on = [module.apim_api]
source = "<approved-api-management-api-policy-module>"
api_resource_name = local.apim_api_name
service_name = local.service_name
resource_group_name = local.apim_resource_group_name
apim_name = local.apim_name
apim_policy_globals = {
backend_base_url = "https://${azurerm_windows_function_app.api.name}.azurewebsites.net/api"
}
apim_api_policy = {
apim_api = "policies/apim-api-policy.xml"
}
}Use the complete XML baseline in Policy authoring.
Configure MFE BFF routes
Owner: Service team
Skip this step unless the API is an MFE BFF.
- Associate the API with
apim-product-mfe-{env}-{reg}-01. Do not copy the capability logic into API policy. - Name the customer path parameter
customerTenantId,customer_tenant_id,tenantId, ortenant_id, or the workspace parameterworkspaceId,workspace_id,ionWorkspaceId, orion_workspace_id. A route with neither is reachable only with an unrestricted (internal) capability token. - Confirm the shell application audience is in the environment’s global audience list. Production does not yet include the MFE UI audience.
- In the BFF, use the shared
Ontinue.Ion.Capabilities.Signetmiddleware to re-verify the capability token, bind it toX-Authorization, and enforce the route permission. Terminate the user token. - If the BFF is called cross-origin, include the
mfe-cors-fragmentand confirm itsallowed-headerscovers the headers the client sends. Observation (Inferred):x-capabilitiesis not in the current list, which matters only for cross-origin calls.
Map every operation to authorization policy
Owner: Service team
The Terraform map key must exactly match the OpenAPI operationId. Declare the
backend rewrite, required roles, and cache behavior.
apim_api_operations_policy = {
get-workspace-summary-v1 = {
file = "./policies/apim-api-operation.xml"
vars = {
rewrite_template_path = "v1/tenants/{tenantId}/workspaces/{workspaceId}/summary"
roles_csv = "\"Ion.Reporting.Read\""
cache_response = "false"
cache_duration = 0
}
}
}Reconcile the complete OpenAPI operation list against this map, and confirm
that the operation template uses roles_csv. A template that ignores it
deploys no role check even though the map looks correct (gap APIM-05 in Signet).
An operation left unmapped still inherits global and API policy but may lack its
role check, rewrite, or cache rule.
Configure safe diagnostics
Owner: Service team
Create the APIM Application Insights logger and API diagnostic using W3C
correlation. Always log errors, but minimize headers and body bytes. Do not log
Authorization, X-Authorization, X-Capabilities, raw claims, or sensitive
bodies.
Use X-Transaction-Id to correlate the gateway request with backend telemetry.
Diagnostics and inherited policy traces together form the effective telemetry
surface, so review both. For reference, Signet’s diagnostic uses 100% sampling,
verbose level, 32 body bytes, and logs client IP; review those settings against
the data classification of your API rather than copying them.
Validate authorization and routing
Owner: Service and Security teams
Test at least:
- valid token, active tenant, and required role;
- missing and malformed token;
- wrong issuer and audience;
- inactive or unknown customer tenant;
- missing operation role;
- an OpenAPI operation with no policy mapping;
- incorrect backend rewrite;
- a client-supplied
X-Authorization; - APIM managed-identity token acquisition failure;
- anonymous and unapproved direct backend access;
- cache isolation across tenants and request variants where caching is enabled; and
- for MFE routes: missing, expired, or tampered capability token, tenant or
workspace path outside the capability scope, and Signet unavailable (all
403).
Keep correlation IDs and status outcomes as evidence; do not retain tokens.
Deploy and record ownership
Owner: Service team
Deploy through the approved environment pipeline. Record the service owner, contract revision, APIM API name, product, gateway path, backend category, selected APIM identity, required roles, diagnostic destination, test evidence, and rollback procedure.
Review checklist
- Every OpenAPI
operationIdhas intentional policy coverage, and the template enforces the mapped roles. - Product, API, and operation policy sections retain
<base />. - MFE BFF APIs are in the MFE product and use the required path parameter names.
- Backend authentication uses APIM managed identity.
- Backend OAuth rejects anonymous direct access.
- Role names use the controlled
Ion.*catalogue. - Cache keys preserve customer and capability isolation.
- Logging excludes credentials and sensitive payloads.
- API and backend can be revoked independently.