APIM Platform Provisioning
The platform baseline is implemented under
rome-ion/infrastructure/spoke/apim. It creates one Rome APIM service in each
environment and installs the controls inherited by service-owned APIs.
Resource convention
| Concern | Deployed convention |
|---|---|
| Environment short codes | apa, bta, gma, prd |
| Resource group | rg-rome-{env}-chn-01 |
| APIM service | apim-rome-{env}-chn-02 |
| Primary APIM UAMI | id-apim-{env}-chn-01 |
| Internal API UAMI | id-apim-{env}-chn-inapi |
| AI API UAMI | id-apim-{env}-chn-aiapi |
Identifiers, audiences, tenant values, and secrets remain controlled environment configuration.
Provisioning sequence
Provision APIM and attach its identities
Owner: Platform team
Create the environment APIM service and attach the primary, internal API, and AI API user-assigned managed identities. Capacity and SKU are environment settings; the resource name and ownership model remain consistent.
module "rome_apim" {
source = "<approved-api-management-module>"
resource_group_name = "rg-rome-${var.environment_short}-chn-01"
application_short = "rome"
instance_count = "02"
sku_name = var.apim_sku_name
user_assigned_msi_ids = [
azurerm_user_assigned_identity.apim.id,
azurerm_user_assigned_identity.internal_api.id,
azurerm_user_assigned_identity.ai_api.id,
]
}Do not use client secrets or certificates for APIM-to-Azure authentication.
Grant Key Vault and backend permissions
Owner: Platform and backend owners
Grant the primary APIM identity access to the Key Vault values required by APIM. Grant each APIM identity only the backend application roles and Azure permissions needed for its trust boundary. A backend owner must approve the principal and audience accepted by that backend.
Validate that removing the grant causes token acquisition or backend access to fail closed.
Create controlled named values
Owner: Platform team
Create APIM named values for environment-specific configuration such as:
- backend/API audience;
- selected APIM managed-identity client;
- Ontinue tenant configuration;
- tenant-validation endpoint and cache duration; and
- approved edge metadata where enforced.
Use Key Vault references for secret values:
resource "azurerm_api_management_named_value" "backend_audience" {
name = "APIM-BACKEND-AUDIENCE"
display_name = "APIM-BACKEND-AUDIENCE"
resource_group_name = var.resource_group_name
api_management_name = var.apim_name
secret = true
value_from_key_vault {
secret_id = azurerm_key_vault_secret.backend_audience.id
identity_client_id = azurerm_user_assigned_identity.apim.client_id
}
}Policy XML references a named value as {{APIM-BACKEND-AUDIENCE}}; it does not
contain the environment value.
Install shared policy fragments
Owner: Platform team
Install request, response, and error fragments before the global policy that references them.
apim_policy_fragment = {
fragment-request-trace = "apim_policies/request-trace.xml"
fragment-response-trace = "apim_policies/response-trace.xml"
fragment-error-trace = "apim_policies/error-trace.xml"
}Fragments must follow the telemetry requirements in the APIM guidelines. Full bodies and identity payloads are not a safe default.
Install the environment global policy
Owner: Platform team
Apply the global policy only after APIM, identities, named values, and fragments exist. The policy must provide the same control behavior in every environment, while audiences and tenant settings remain environment-specific.
module "rome_apim_global_policy" {
depends_on = [module.rome_apim, module.policy_fragments]
source = "<approved-api-management-policy-module>"
api_management_id = module.rome_apim.apim_id
apim_policy = {
apim = "apim_policies/apim_global_policy_${var.environment_short}.xml"
}
}Validate XML compilation and denied requests before onboarding service APIs. The global policy implementation documents the exact execution order, environment differences, trace fragments, and public-health bypass.
Deploy public and authenticated health operations
Owner: Platform team
Import the platform health OpenAPI contract and bind each operationId to its
policy. Public GET and HEAD health operations return only synthetic gateway
health. Authenticated health inherits the global policy and requires the approved
health-read role.
A public health operation must not be reused as proof of backend readiness.
Configure capacity, diagnostics, and portal posture
Owner: Platform team
Configure autoscaling and operational alerts for the APIM tier. Disable basic portal authentication and leave delegated registration/subscription disabled. ION does not depend on the developer portal for API publication or subscription keys for caller security.
Declare diagnostic destinations, access, sampling, redaction, and retention as reproducible platform configuration. Notification destinations must be owned team channels rather than personal mailboxes.
Platform validation
For every environment, prove:
- missing and invalid caller tokens are denied;
- inactive customer tenants are denied;
- valid caller and operation role reaches the intended API policy;
- APIM can obtain the expected backend token;
- the backend rejects anonymous and unapproved direct calls;
- public and authenticated health operations have distinct behavior;
- policy fragments do not emit credentials or prohibited payloads; and
- scale and alert configuration target an owned operational channel.