Microservices Identity Workflow
Every Azure-hosted ION workload uses managed identity for service-to-service and Azure-resource access. For a call through APIM, the workload obtains an ION API token; APIM validates that caller and operation, then authenticates to the OAuth-protected backend using an APIM user-assigned managed identity.
Mandatory workload-identity boundaries
Each independently operated microservice has a dedicated user-assigned managed identity.
Compute resources implementing the same microservice may share its UAMI. Unrelated microservices, environments, and operational owners MUST NOT share one identity.
A microservice and the Azure resources it owns are deployed in its service resource group.
The resource group is the default ownership, lifecycle, authorization, and cost boundary. Shared platform resources remain in explicitly governed shared resource groups.
A microservice UAMI may receive Azure RBAC only in its own resource group or an approved shared-resource group.
Assignments in another microservice's resource group, at subscription scope, or at management-group scope are prohibited unless Security approves a documented exception.
ION application roles authorize API operations; Azure RBAC authorizes Azure-resource operations.
Neither permission system substitutes for the other. Every assignment must identify a target, operation, scope, owner, and review path.
Azure compute ingress requires Microsoft Entra OAuth authentication at the platform boundary.
Function Apps, App Services, Container Apps, Logic Apps, and equivalent HTTP-capable workloads MUST reject unauthenticated requests before application code runs. APIM and private networking are additional controls, not substitutes.
Mandatory boundary: A microservice UAMI MUST receive Azure RBAC only in its own resource group or an explicitly approved shared-resource group. It MUST NOT receive access to another microservice’s resource group, subscription scope, or management-group scope without a documented Security exception. The exception must identify the dependency, rejected narrower scopes, roles, resources, owner, expiry or review date, and revocation plan.
Workload populations
This workflow applies to Customer Portal and Alya BFFs, synchronous APIs, background workers, event publishers and consumers, daemons, onboarding services, audit services, and integration adapters hosted in Azure. Each independently operated workload has an attributable managed identity and an owning team.
A dedicated user-assigned managed identity (UAMI) is the V2 standard for a microservice. Its identity and grants survive compute replacement and can be provisioned before the workload. Multiple compute resources implementing the same service may use that service identity. Unrelated services do not share it.
System-assigned and user-assigned managed identity
Both identity types remove application credentials from an Azure workload, but they have different ownership and lifecycle characteristics.
| Property | System-assigned managed identity (SAMI) | User-assigned managed identity (UAMI) |
|---|---|---|
| Creation | Enabled as part of one Azure compute resource | Created as an independent Azure resource and attached to compute |
| Lifecycle | Created and deleted with its parent resource | Independent lifecycle; explicitly created, attached, detached, and deleted |
| Sharing | Attached only to its parent resource | May be attached to multiple compute resources implementing the same microservice |
| Pre-authorization | Assignments normally follow creation of the host | Can receive approved assignments before a replacement host is deployed |
| Host replacement | A replacement host receives a new principal and requires new assignments | The same identity and approved assignments survive host replacement |
| Best fit | A workload owned and executed by exactly one long-lived Azure resource | A microservice spanning multiple hosts, using deployment slots, or requiring stable identity and pre-authorization |
| ION V2 use | Permitted for a truly single-resource workload when coupled lifecycle is intentional | Default for microservices: one UAMI per microservice and environment |
Choosing UAMI does not permit a universal identity shared by unrelated services. The UAMI represents one service responsibility and remains bounded by that service’s resource group, dependencies, environment, and owner.
Which operations can I perform using managed identities?
Authorized operators and deployment automation can:
- create, read, update, and delete UAMI resources;
- attach or detach a UAMI to supported Azure compute resources;
- assign ION Platform API application roles to the managed-identity service principal for approved API operations;
- assign Azure RBAC roles for approved operations in the microservice’s own resource group or an approved shared-resource group;
- request access tokens from the Azure managed-identity endpoint through the Azure Identity SDK or a platform-native integration;
- inspect identity resource changes in Azure Activity Log;
- inspect managed-identity sign-in activity in Entra workload sign-in logs; and
- revoke access by removing an app-role or RBAC assignment, detaching the UAMI, disabling the route/workload, or deleting the identity during offboarding.
Managed-identity resources can be managed with declarative infrastructure, Azure CLI, PowerShell, ARM/REST, or the Azure portal. ION uses declarative automation as the system of record. Portal operations are for diagnosis or an approved emergency procedure and must be reconciled back to source control.
A managed identity does not itself grant access. The target still requires an explicit application-role or Azure RBAC assignment and validates the resulting token and operation.
Micrososervice identity flow
Service trust flow
For service API calls, the token audience is the approved ION service/API audience and application roles describe the caller’s permitted capabilities. For direct Azure data-plane calls, the audience is the target Azure resource and Azure RBAC provides authorization.
A BFF follows this flow only after terminating and authorizing the user request. The user’s token never becomes the service token and is never propagated. A worker created by a request obtains its own managed-identity token rather than persisting the initiating bearer token.
OAuth protection for Azure compute ingress
Every HTTP-capable Azure compute resource MUST enforce Microsoft Entra OAuth before a request reaches application or workflow code. Anonymous access is prohibited for ION APIs, functions, workflows, containers, callbacks, and administrative endpoints.
This control protects the workload’s direct Azure hostname as well as traffic routed through APIM. APIM authentication, private endpoints, access restrictions, and firewalls provide additional layers, but none replaces authentication on the compute resource itself. If APIM routing or a network rule is misconfigured, the backend must still reject a request without a valid access token.
Platform enforcement
Use the platform-native authentication control that applies to the hosting service and deploy it through infrastructure as code:
| Azure compute | Required inbound protection |
|---|---|
| Azure App Service and Function Apps | Enable App Service Authentication/Authorization (authsettingsV2, also called Easy Auth) with Microsoft Entra ID. Require authentication for all API paths and return 401 Unauthorized rather than redirecting an API caller. |
| Azure Container Apps | Enable built-in authentication with Microsoft Entra ID, set Restrict access to Require authentication, reject unauthenticated API requests with 401, require HTTPS, and keep insecure ingress disabled. |
| Logic Apps Standard | Enable the App Service/Functions authentication layer for request-trigger endpoints and require Entra-authenticated calls. Apply network restrictions independently. |
| Logic Apps Consumption | Configure an Entra OAuth authorization policy for request-based triggers with the exact issuer and audience. Disable SAS authentication when OAuth is the approved calling mechanism so possession of a callback URL is not an alternate authorization path. |
| Other HTTP-capable Azure compute | Use its native Entra/OAuth ingress feature where available. If the platform has no suitable native control, require an approved architecture that combines private ingress with application-level JWT validation before the endpoint can be released. |
| Event-only worker with no HTTP ingress | No HTTP authentication surface exists. Authenticate the trigger’s Azure resource access with managed identity and Azure RBAC, and do not enable an unused public HTTP endpoint. |
The protected-resource audience is the environment’s approved ION API audience,
normally the Platform API Application for internal service traffic. The
platform control validates the token before forwarding the request; APIM and the
application still validate the expected audience, approved caller, required
Ion.* application role, customer context, operation, and domain rules.
Platform authentication is not a replacement for application authorization.
Configuration requirements
For every protected compute endpoint:
- configure Microsoft Entra ID as the identity provider and accept tokens only for the environment-specific API audience;
- bind issuer and tenant validation to the Ontinue platform tenant for internal service traffic;
- require HTTPS and reject unauthenticated API requests with
401rather than a browser sign-in redirect; - disable anonymous access, platform access keys, SAS callbacks, and default public endpoints when they provide an alternate path around OAuth;
- disable the platform token store unless a documented flow needs it; backend services do not use it to propagate user tokens;
- restrict direct ingress with private endpoints, access restrictions, or equivalent network controls where supported;
- protect deployment, SCM, administration, and diagnostic endpoints separately; and
- declare narrowly scoped excluded paths only when the platform requires an unauthenticated health probe. Such a path must expose no customer data, state, configuration, dependency details, or operation capability.
Required validation
Release tests call both the APIM route and the direct compute hostname where the hostname is reachable. Verify that:
- no token, a malformed token, an expired token, a wrong-issuer token, and a wrong-audience token are rejected before application processing;
- a valid token without the route’s application role is denied by APIM or the backend;
- only an approved managed-identity caller can perform the operation;
- a direct-host request cannot bypass authentication, customer isolation, or operation authorization;
- any excluded health path returns only the approved minimal response; and
- authentication settings, allowed audiences, anonymous-action behavior, and network restrictions are checked for configuration drift.
See Authentication and authorization in Azure App Service and Azure Functions, Authentication and authorization in Azure Container Apps, and Secure access and data for workflows in Azure Logic Apps.
APIM and backend validation
For service-to-service traffic, APIM validates:
- signature, validity period, issuer, and expected service audience;
- that the calling managed identity is an approved caller for the route;
- the application role required by the operation; and
- route, rate, quota, payload, and correlation policies where configured.
After validating the caller and route role, APIM obtains a token as the selected
APIM user-assigned managed identity for the protected backend audience and
replaces backend Authorization. Token acquisition is fail-closed. The backend
platform OAuth validates the APIM identity, and the application independently
enforces trusted customer context, operation authorization, and domain rules so a
routing or policy error does not become an authorization bypass.
Private networking and platform ingress controls restrict direct backend access. Where direct service invocation is intentionally supported, it is a separate contract: the target must explicitly trust and authorize that caller rather than relying on the APIM backend identity.
Application roles and Azure RBAC
The internal Platform API Application registration provides the controlled
Ion.* capability-role catalogue. Each caller receives only the roles required
for its outbound calls; each API route declares and validates its required role.
Azure RBAC is assigned separately for Cosmos DB, Service Bus, Key Vault, Storage, Log Analytics, and other Azure resources:
| Target | Permitted assignment scope | Approval requirement |
|---|---|---|
| Resource owned by the microservice | The individual resource or the microservice’s own resource group | Service and resource owner through normal deployment review |
| Governed shared platform resource | The individual shared resource or its approved shared-resource group | Service owner and shared-resource owner |
| Resource owned by another microservice | Prohibited by default | Documented Security exception plus both service owners; prefer an API instead |
| Subscription or management group | Prohibited by default | Security exception only when no narrower technical scope can satisfy the requirement |
Assignments use the narrowest practical scope. API roles never substitute for Azure RBAC, and Azure RBAC never grants an ION API operation.
Implementation: acquire a token with a UAMI
Use the Azure Identity SDK and explicitly select the microservice’s UAMI. The client ID is deployment configuration, not a secret; keep its environment-specific value in the controlled configuration inventory rather than in source or this page.
using Azure.Core;
using Azure.Identity;
var uamiClientId = configuration["ManagedIdentity:ClientId"]
?? throw new InvalidOperationException("ManagedIdentity:ClientId is required");
var platformApiUri = configuration["Identity:PlatformApiUri"]
?? throw new InvalidOperationException("Identity:PlatformApiUri is required");
var credentialOptions = new DefaultAzureCredentialOptions
{
ManagedIdentityClientId = uamiClientId,
// Production workloads must not fall back to developer or shared credentials.
ExcludeEnvironmentCredential = true,
ExcludeAzureCliCredential = true,
ExcludeAzurePowerShellCredential = true,
ExcludeAzureDeveloperCliCredential = true,
ExcludeVisualStudioCredential = true,
ExcludeVisualStudioCodeCredential = true,
ExcludeInteractiveBrowserCredential = true
};
var credential = new DefaultAzureCredential(credentialOptions);
var token = await credential.GetTokenAsync(
new TokenRequestContext([$"{platformApiUri}/.default"]),
cancellationToken);
using var request = new HttpRequestMessage(HttpMethod.Get, targetUri);
request.Headers.Authorization =
new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", token.Token);
request.Headers.Add("X-Transaction-Id", correlationId);
using var response = await httpClient.SendAsync(request, cancellationToken);
response.EnsureSuccessStatusCode();
For direct Azure-resource access, replace the API scope with that resource’s
scope, for example https://vault.azure.net/.default for Key Vault. Prefer the
service’s Azure SDK client, which accepts a TokenCredential, over manually
constructing REST authorization headers.
Do not log token.Token, place it in telemetry, persist it, or add a fallback
client secret. Token caching and renewal are handled by the Azure Identity SDK.
Rationale
| Decision | Rationale | Consequence |
|---|---|---|
| Managed identity for every Azure workload | Removes deployable credentials, binds authentication to an Azure principal, and provides Entra and Azure audit evidence | Workloads fail closed when managed identity is unavailable; secret or certificate fallback is prohibited |
| One UAMI per microservice and environment | Preserves stable identity across host replacement while keeping attribution, grants, revocation, and blast radius aligned to one service | Unrelated services cannot share an identity; each environment has independent assignments |
| One resource group per microservice | Aligns resource ownership, lifecycle, deployment, cost, and default RBAC scope | Cross-service resource access is exceptional; expose a service API or use an approved shared resource instead |
| RBAC only in the service or approved shared resource group | Prevents a compromised microservice from inheriting broad or neighboring-service access | Cross-resource-group access requires explicit owners and Security review; subscription-wide grants are not a convenience mechanism |
Platform API Application roles for internal APIs | Provides a stable, operation-oriented permission catalogue and a uniform service audience | Each caller receives only required Ion.* roles; role assignment remains distinct from Azure RBAC |
| Platform OAuth on every HTTP compute endpoint | Prevents direct Azure hostnames or routing mistakes from creating an unauthenticated path around APIM | Every request is authenticated before workload code runs; platform authentication and application authorization are both required |
| APIM validates callers and authenticates to backends with its UAMI | Separates external caller authorization from backend platform authentication and protects direct compute endpoints with OAuth | APIM audit preserves caller attribution; the backend authenticates the approved APIM principal and uses bounded validated context |
| Backend revalidates authorization | Prevents APIM routing or policy errors from becoming authorization bypasses | Platform OAuth validates APIM, while the application enforces customer isolation, operation, and domain rules |
Step-by-step implementation
Define the microservice identity boundary
Owner: Service team
Record the microservice name, environment, accountable owner, compute resources, owned resource group, inbound APIs, outbound APIs, Azure dependencies, operations, data classification, and customer-isolation requirements.
Create a caller-to-target matrix with:
- target API or Azure resource;
- target audience or Azure resource scope;
- required
Ion.<Resource>.<Operation>[.<Constraint>]application role or Azure RBAC role; - exact resource scope;
- whether the resource is service-owned or in an approved shared-resource group;
- target owner and approval; and
- negative tests and revocation path.
Any dependency on another microservice’s resource group must be redesigned as an API call or submitted as a Security exception before deployment.
Create the service resource group and UAMI
Owner: Service team and platform engineering
Provision one resource group and one UAMI per microservice and environment through the approved infrastructure modules. Use stable naming from the platform naming standard; do not copy identifiers between environments.
resource "azurerm_resource_group" "service" {
name = "rg-${var.service_name}-${var.environment}-01"
location = var.location
}
resource "azurerm_user_assigned_identity" "service" {
name = "id-${var.service_name}-${var.environment}-01"
resource_group_name = azurerm_resource_group.service.name
location = azurerm_resource_group.service.location
}Add the identity, environment, resource group, owners, and review date to the controlled workload-identity inventory.
Attach the UAMI to every host for this microservice
Owner: Service team
Attach the same service UAMI only to compute resources that implement the same microservice responsibility. Do not attach it to unrelated functions, apps, workers, deployment agents, or administration tools.
resource "azurerm_linux_function_app" "service" {
# Existing application configuration omitted.
identity {
type = "UserAssigned"
identity_ids = [azurerm_user_assigned_identity.service.id]
}
}Configure the UAMI client ID as environment-specific application configuration. Remove client-secret and certificate settings from the workload and pipeline.
Assign ION Platform API application roles
Owner: API owner and platform identity team
For each approved ION API dependency:
- Resolve the UAMI’s service-principal object ID.
- Resolve the environment’s
Platform API Applicationservice principal. - Resolve the immutable ID of the approved
Ion.*application role. - Create the service-principal app-role assignment through declarative automation using Microsoft Graph or an approved provider.
- Wait for propagation and verify that a token for the Platform API audience contains only the expected application roles.
The role value—not its environment-specific GUID—is the architectural contract. Do not assign all Platform API roles to simplify deployment.
Assign Azure RBAC within the permitted boundary
Owner: Service team and resource owner
Grant only required Azure data actions or control-plane actions. Prefer a resource scope over a resource-group scope.
resource "azurerm_role_assignment" "service_bus_sender" {
scope = azurerm_servicebus_namespace.shared.id
role_definition_name = "Azure Service Bus Data Sender"
principal_id = azurerm_user_assigned_identity.service.principal_id
principal_type = "ServicePrincipal"
}Before applying an assignment, enforce these checks:
- the target is in the microservice’s own resource group or an approved shared resource group;
- the target owner approved the operation and scope;
- no broader role or scope is used for deployment convenience; and
- any other scope has a recorded, current Security exception.
Acquire target-specific tokens in application code
Owner: Service team
Use the Azure Identity SDK as shown in Implementation: acquire a token with a
UAMI. Request only the target
API’s /.default scope or the intended Azure resource scope.
The workload must:
- explicitly select its UAMI;
- rely on SDK token caching and renewal;
- create a new managed-identity token for background execution rather than retain an initiating user token;
- propagate correlation and validated customer context separately from the bearer token; and
- fail closed without a secret, certificate, user token, or more-privileged identity fallback.
Enforce OAuth at the Azure compute boundary
Owner: Service team and platform engineering
Configure the hosting platform described in OAuth protection for Azure compute ingress:
- select Microsoft Entra ID and the environment-specific API audience;
- require authentication and configure API failures as
401 Unauthorized; - disable anonymous access and alternate key/SAS paths;
- require HTTPS and apply private ingress or access restrictions where supported;
- declare any minimal health-probe exclusion explicitly; and
- deploy and monitor the configuration through infrastructure as code.
Test the direct compute hostname with no token and invalid issuer/audience tokens. The request must fail before the application or workflow processes it. For Logic Apps Consumption, verify the Entra authorization policy and that SAS authentication is disabled when OAuth is the approved path.
Configure APIM and target validation
Owner: API owner and platform engineering
Configure the route and backend to validate:
- cryptographic signature, issuer, validity interval, and token version;
- the exact target audience;
- the approved managed-identity caller;
- the required application role for the operation; and
- applicable customer, resource, and domain authorization.
APIM validates the caller token and operation role, then acquires a token as the
selected APIM UAMI and replaces backend Authorization. Configure backend OAuth
to accept the intended APIM principal and audience. Protect backend ingress so a
direct request cannot bypass authentication or application authorization.
Validate, release, inventory, and monitor
Owner: Service team, API owner, and Security
Run positive tests for each approved API operation and Azure-resource operation. Run negative tests for:
- missing and incorrect application roles;
- missing and over-scoped Azure RBAC;
- wrong audience, issuer, caller, or environment;
- another microservice’s UAMI;
- another customer’s context;
- direct-backend access with no token or an invalid token;
- anonymous or alternate key/SAS access to the compute endpoint; and
- unavailable managed identity with no credential fallback.
Record deployed attachments and assignments, approvals, test evidence, review date, and revocation procedure. Alert on unexpected callers, denied cross-scope operations, role/RBAC drift, and assignments outside service-owned or approved shared-resource groups.
Revocation and offboarding
To remove one capability, delete the relevant application-role or Azure RBAC assignment and verify that the operation is denied. Account for short-lived token and authorization caches in emergency response: detach or disable the managed identity, block the route, stop the workload, or deny network access when revocation cannot wait for token expiry.
To retire a workload, stop callers, remove route access, remove application-role and RBAC assignments, detach the identity from compute, and then delete the identity after dependency checks. Orphaned identities and assignments are detected through periodic inventory reconciliation.
Audit and failure behavior
Entra workload sign-ins, app-role changes, Azure RBAC changes, APIM decisions, backend authorization failures, and Azure-resource denials are auditable. Service logs include workload identity, target audience category, operation, customer context when applicable, and correlation identifier. They never include bearer tokens or authorization headers.
Token acquisition failure, invalid audience, unapproved caller, or absent role fails closed. Authentication failures are distinguished from authorization denials. Transient Entra or dependency errors use bounded retries and normal resilience controls; code must not fall back to shared secrets, user tokens, or a more privileged identity.