Internal API identity and access
The Internal API is a machine-to-machine API for Ontinue-owned workloads and internal teams. It is not a customer-facing or public API. This document records the identity and access behavior that is verifiable in the repository and calls out where reference intent differs from the checked-in APIM runtime policy.
For the surrounding design and operating guidance, see architecture, implementation, and the consumer guide. The governing decisions are ADR-0013: service-to-service authentication, ADR-0014: shared APIM, and ADR-0015: layered edge.
Trust boundaries and identity legs
Authentication has two distinct legs. APIM first authenticates and authorizes the internal caller. For operations that proxy to the platform backend, APIM then replaces the caller credential with a token acquired by the Internal API’s dedicated APIM user-assigned managed identity (UAMI).
| Leg | Principal presented | Token audience | Enforcement evidenced in the repository |
|---|---|---|---|
| Caller to APIM | Ontinue workload identity, preferably a managed identity | Environment-specific Internal API Entra app | Global APIM JWT validation followed by operation-level app-role checks |
| APIM to backend | Dedicated id-apim-{env}-chn-inapi UAMI | Environment-specific platform backend application ID in APIM-AZURE-AD-APPLICATION-ID | Operation policy obtains a managed-identity token and overwrites both authorization headers |
This implementation-specific token replacement differs from the general service-to-service flow described in ADR-0013 and ADR-0014, where a caller’s service token normally remains the backend identity. For the Internal API, the backend sees APIM’s dedicated UAMI as the authenticated principal, not the original workload.
Caller token acquisition
Consumers should request the environment-specific scope:
api://<client-id>/.default
The workload must already have an Internal API app role assignment. Entra emits
assigned application permissions in the JWT roles claim; APIM does not infer
roles from the workload’s Azure RBAC assignments.
Managed identity is the recommended credential because it avoids a workload secret. The reference consumer material also permits OAuth client credentials for a service principal. However, the Internal API Entra application definitions, client service-principal registrations, credentials, and app-role assignments are not defined in this repository. The availability and exact onboarding procedure for either caller type therefore cannot be independently verified here.
| Environment | Code | Internal API Entra application | Client ID |
|---|---|---|---|
| Alpha | apa | azsp-ontinue-rome-idm-ion-internal-api-apa-01 | 45aacb32-7844-4894-9986-d5e78886a8da |
| Beta | bta | azsp-ontinue-rome-idm-ion-internal-api-bta-01 | 470448ab-4f56-46f3-86d5-1d08f62a6048 |
| Gamma | gma | azsp-ontinue-rome-idm-ion-internal-api-gma-01 | 533c71b6-179d-4dd7-bdf5-20c1ef540e25 |
| Production | prd | azsp-ontinue-rome-idm-ion-internal-api-prd-01 | 97f30357-df31-4707-b642-642983da854b |
Environment separation matters: callers should not reuse a token minted for a different environment’s Internal API app.
APIM authentication and tenant handling
The checked-in global APIM policy performs these steps before operation policy:
- Require an
Authorizationheader. - Parse
tidfrom the unverified token only to construct tenant-validation context. Absence oftidis rejected before cryptographic validation. - Treat the Ontinue tenant
(
f0ee8740-91f2-48ba-a8e5-73d381b3aa8d) as trusted for the tenant allow-list step. For another tenant, query the configured tenant-validation endpoint and cache the active/inactive result; inactive tenants are rejected. - Validate a signed bearer JWT through Entra OpenID configuration. The issuer
list supports Entra v1 (
https://sts.windows.net/{tenant-id}/) and v2 (https://login.microsoftonline.com/{tenant-id}/v2.0) forms. - Require both
rolesandtidclaims. - Reject application tokens (
idtyp=app) whentidis not the Ontinue tenant.
Consequently, Ontinue application tokens are the intended Internal API caller class, while non-Ontinue application tokens are explicitly denied. The global policy still contains customer-tenant handling because it is shared across APIM surfaces. Internal API callers should be Ontinue-tenant identities; successful customer-tenant validation does not make a customer workload an approved Internal API consumer.
Audience discrepancy and risk
The consumer contract says the caller token should target only the
environment-specific Internal API app. The current global APIM runtime policy
does not enforce that exclusivity. Its validate-jwt audience list contains
the Internal API client ID alongside several portal, platform, workbench, and
other application audiences for the environment.
Operation policies then authorize solely by matching strings in roles.
Therefore, an Ontinue-tenant token for another audience accepted by the global
policy could reach an Internal API operation if it contains a role string that
matches that operation’s roles_csv. There is no checked-in Internal API-level
policy that revalidates aud against only the Internal API client ID.
This is a material policy discrepancy and a privilege-boundary risk. The desired control is an API-level audience check for the environment-specific Internal API app, in addition to the global policy. Until that exists, app-role names must not be assumed to provide audience isolation by themselves.
Operation authorization
Each operation policy reads the already validated JWT from APIM context and
compares its roles values with Terraform’s roles_csv. The check uses
Any(...): possession of any configured role is sufficient. A missing roles
claim is rejected globally; a present claim with no matching operation role is
rejected by the operation policy.
| Authorization source | Purpose | Runtime authority |
|---|---|---|
| Global APIM policy | Require a signed token, accepted issuer/audience, tid, and roles; apply tenant behavior | Enforced |
Terraform roles_csv rendered into operation XML | Define accepted app roles for one operation | Enforced, any-of |
OpenAPI BearerAuth scope arrays | Describe expected permissions to consumers and tooling | Documentation only |
The OpenAPI permissions are not an APIM enforcement source and are currently inconsistent with runtime authorization for the consent-validation operation:
| Operation | OpenAPI documents | Terraform/APIM actually accepts |
|---|---|---|
| Consent validation | Ion.Platform.CustomerConfigurationData.Read or Ion.Platform.CustomerConfigurationData.ReadWrite | Ion.Internal.Customers.Read or Ion.Internal.Customers.Read.All |
There is also a semantic hazard when multiple OpenAPI OAuth scopes appear in one
security requirement: tooling can interpret them as all required, while the
operation policy implements any-of. Consumer access reviews and tests must use
the rendered roles_csv until the contract and runtime are reconciled.
Backend identity and request context
For proxied operations, APIM uses authentication-managed-identity with the
UAMI client ID stored as APIM-INAPI-MSI-CLIENT-ID. The resource is the platform
backend application ID stored as APIM-AZURE-AD-APPLICATION-ID. APIM then
overrides both headers:
Authorization: Bearer <APIM-UAMI-platform-token>X-Authorization: Bearer <APIM-UAMI-platform-token>
The caller token is not forwarded in either header. This limits backend trust to
the platform audience and makes APIM’s dedicated UAMI the backend principal.
The repository provisions one UAMI named id-apim-{env}-chn-inapi per
environment and attaches the corresponding client ID to APIM through a named
value.
Before those headers are replaced, the global policy overwrites X-Tenant-Id
with tid from the validated caller JWT. The backend therefore receives two
pieces of context with different origins:
| Backend input | Meaning | Trust condition |
|---|---|---|
Authorization and X-Authorization | APIM’s dedicated Internal API UAMI authenticated for the platform backend | Backend validates the platform audience and the UAMI’s required backend app role |
X-Tenant-Id | Tenant of the original, APIM-validated caller | Trust only when the request is known to have traversed APIM, which overwrites caller input |
For the intended caller class, X-Tenant-Id is the Ontinue tenant. It is caller
provenance context, not a customer selection or proof that the caller may access
a specific customer’s data. Customer/resource authorization must come from the
operation, backend domain rules, and requested resource. A backend directly
reachable outside APIM must not trust a client-supplied X-Tenant-Id.
Responsibility matrix
| Actor or component | Responsibility | Must not be assumed to do |
|---|---|---|
| Internal consumer owner | Use the correct environment, protect its identity, request /.default, and seek least-privilege app roles | Self-assign roles or call the platform backend with the Internal API token |
| Entra administrator | Define Internal API apps and roles; assign approved workload identities; disable or revoke access | Rely on repository Terraform for assignments that are not present here |
| Shared APIM global policy | Validate bearer token signature, accepted issuer/audience, tenant behavior, tid, and presence of roles | Exclusively bind the request to the Internal API audience today |
| Internal API operation policy | Enforce operation roles_csv, route the request, and acquire the APIM UAMI backend token | Enforce OpenAPI scopes automatically or preserve caller identity in backend JWT headers |
| APIM platform owner | Provision and attach id-apim-{env}-chn-inapi; manage named values and global policy safely | Treat the shared global policy as an API-specific audience boundary |
| Platform backend | Validate the platform token and its role; enforce resource/domain authorization; treat tenant headers as context | Infer the original caller identity from APIM’s backend JWT or trust direct headers |
| API owner | Keep OpenAPI permissions, Terraform roles, policy behavior, and tests aligned | Publish the Internal API as a public/customer integration contract |
Denial behavior
| Condition | Observed policy result |
|---|---|
Missing Authorization, invalid/missing tid, inactive external tenant, missing roles, or non-Ontinue app token | 401 Unauthorized |
| Signature, issuer, audience, expiry, or bearer-token validation failure | Rejected by validate-jwt; no Internal API-specific override is defined |
No operation role matches roles_csv | 403 Forbidden |
| Successful-call rate limit exceeded | 429 Too Many Requests from the API-level rate-limit policy |
| APIM cannot acquire the UAMI backend token | Request fails because ignore-error="false"; no operation-specific fallback is defined |
Authentication and authorization failures are traced through shared APIM fragments. Authorization headers are excluded from traced request and response header metadata. Policies should avoid returning role inventories or other sensitive diagnostic detail to callers even though internal trace context may record the required and available roles.
Revocation and blast radius
| Change or compromise | Effective behavior and blast radius |
|---|---|
| Remove a caller’s Internal API app-role assignment or disable its identity | Blocks newly issued usable tokens; already issued JWTs can remain accepted until expiry because APIM validates JWTs rather than introspecting each request |
| Compromise one caller managed identity | Exposes the environments and operations represented by that identity’s current tokens and app roles; separate workload identities and least-privilege roles contain impact |
Remove a backend app-role assignment from id-apim-{env}-chn-inapi | Disrupts backend access for all proxied Internal API operations in that environment after token/cache expiry |
| Compromise the dedicated APIM UAMI path | Can affect every platform-backend operation available to that shared Internal API UAMI in one environment; environment-specific UAMIs limit cross-environment impact |
| Change the global audience/issuer policy incorrectly | Can admit or deny callers across multiple APIs on the shared APIM instance, not only the Internal API |
| Leak a client secret for a client-credentials consumer | Enables use outside its original Azure workload until credential revocation; this is why managed identity is preferred |
Revocation procedures should account for Entra token lifetime and APIM managed identity token caching. Emergency containment may require disabling the principal or credential, removing app-role assignments, and blocking the route while existing tokens expire.
Threats and mitigations
| Threat | Current mitigation | Residual risk or required action |
|---|---|---|
| Forged or modified caller JWT | APIM requires signed tokens and validates against Entra OpenID metadata | Preserve fail-closed policy and monitor validation failures |
| Customer workload calls Internal API with an app token | Global policy rejects non-Ontinue idtyp=app tokens | Internal identities still require explicit least-privilege assignments |
| Wrong-audience Ontinue token reaches an operation | Global accepted-audience list and operation role check provide partial controls | Add Internal API-specific audience validation; current role-string matching is not sufficient isolation |
| Caller role escalation | Entra app-role assignment plus per-operation roles_csv | App definitions and assignments are outside this repository and need independent governance/audit |
| Caller token reaches backend | Operation policy overwrites Authorization and X-Authorization with the UAMI token | Ensure every proxied operation follows the same replacement pattern |
| Spoofed tenant header | APIM overwrites X-Tenant-Id from the validated caller token | Restrict direct backend access; never use the header alone for customer authorization |
| Direct backend bypass of APIM controls | Backend is expected to require the platform audience and APIM UAMI role | Network exposure, backend authentication configuration, and the UAMI’s backend role assignment are not verified here |
| Over-broad APIM UAMI | Dedicated environment-specific UAMI separates this path from the primary APIM identity | Exact backend app-role grants are absent from the repository; verify they are least privilege in Entra |
| Contract-policy drift | Terraform is the runtime role source and OpenAPI documents intent | Add automated comparison tests; fix the consent-operation mismatch |
| Shared gateway policy failure | One APIM per environment centralizes validation and telemetry | Stage and test global-policy changes because their blast radius spans APIs |
Direct backend access assumptions
The architecture assumes consumers call the Internal API ingress and do not call Doppio/platform endpoints directly. Repository evidence shows that APIM targets the platform application audience and presents the dedicated UAMI. That supports an identity boundary, but it does not prove the backend is network-private or that it rejects every other platform principal.
A complete verification must establish all of the following in deployed Azure:
- the backend’s accepted audience is the environment’s platform application;
- the dedicated
id-apim-{env}-chn-inapiservice principal has only the required backend app roles; - direct network paths are private or otherwise constrained to approved ingress;
- the backend validates both the platform token and required role rather than
trusting APIM routing or
X-Tenant-Idalone; and - no alternate public endpoint bypasses global and operation APIM policy.
Until verified, “backend access only through APIM” is an architectural assumption, not a repository-proven runtime invariant.
Evidence limits and follow-up verification
This document is based on checked-in global APIM policies, Internal API operation policies, Terraform, OpenAPI, and reference consumer material. It does not include live Azure inspection.
Known evidence gaps are:
- Internal API Entra app registrations, exposed app-role definitions, and owners are not defined in the repository.
- Consumer managed-identity/service-principal app-role assignments are not defined in the repository.
- The dedicated APIM UAMI’s platform-backend app-role assignment is not defined in the repository.
- Live APIM policy deployment, named-value resolution, Entra token claims, token lifetime, and managed-identity token caching were not verified.
- Backend Easy Auth/application validation and direct network accessibility were not verified.
- The repository does not prove that the four Internal API applications exist with the documented identifiers in every live environment.
Production assurance should combine repository review with Entra application and service-principal inspection, app-role assignment export, APIM effective-policy inspection, negative token tests for every audience and tenant class, and direct backend reachability/authentication tests.