Azure identity and security services
This module provides local Azure-compatible identity and secret services. It gives clients an Entra ID token issuer, managed identity token access, and Key Vault or Managed HSM data planes so local applications can use normal Azure SDK credential and secret flows. The wider tenant and request settings are described in Cloud and directory configuration, while directory-facing behavior is described in Microsoft Graph integration.
Mental model
The identity services form one local trust model. Entra ID and managed identity issue tokens, discovery endpoints describe how clients can reach them, Key Vault exposes secret and key operations behind an Azure-style authentication challenge, and ARM requests can optionally validate those tokens.
This diagram shows how local clients obtain credentials and use them with protected service surfaces.
flowchart LR
Client -->|OAuth or OIDC request| Entra
Client -->|IMDS or App Service token request| ManagedIdentity
Entra -->|signed access and ID tokens| Client
ManagedIdentity -->|signed access token| Client
Entra -->|UserInfo and discovery| Client
Client -->|Bearer token| KeyVault
Client -->|Bearer token| ARM
Entra -->|discovery and JWKS| Client
KeyVault -->|secrets, keys, certificates, crypto| Client
ARM -->|resource operations| AzureState[(ARM state)]
EntraStore[(Entra directory state)] --> Entra
ManagedIdentityStore[(Managed identity state)] --> ManagedIdentity
KeyVaultArm[(Key Vault ARM state)] --> KeyVault
References: src/…/EntraServiceHandler.java• L13-28 src/…/EntraStore.java• L25-29 src/…/ManagedIdentityHandler.java• L34-48 src/…/KeyVaultHandler.java• L34-64 src/…/TokenRule.java• L23-39 src/…/TenantMatchRule.java• L19-29
Entra ID endpoints
Entra ID acts as a local OpenID Connect and OAuth 2.0 provider. Tenant-rooted paths accept tenant IDs and the common authority aliases common, organizations, and consumers; the handler resolves the first path segment and sends the request to the matching endpoint. Endpoint URLs use the URL that reached the emulator so local clients can follow discovery results.
| Endpoint family | Client-facing purpose |
|---|---|
| OpenID configuration | Describes the issuer, token endpoint, authorization endpoint, supported grants, JWKS URL, and UserInfo endpoint. |
| JWKS | Publishes the public key used to check emulator-issued JWTs. |
| Token | Issues v1 or v2 access tokens for supported grant types. |
| Authorize | Starts the local authorization-code flow and redirects the client back with a code. |
| User realm | Identifies a username as a managed cloud account before a password grant. |
| Instance discovery | Maps the authority host to the local tenant discovery endpoint before token requests. |
| UserInfo | Returns signed-token-backed OIDC claims for a delegated user. |
The instance discovery endpoint is a client-compatibility surface for MSAL libraries. It returns the tenant discovery URL selected from the supplied authorization endpoint, the emulator authority as both the preferred network and cache host, and authority aliases from the matching cloud profile. When the request includes a port, the response keeps it so the client continues to use the local service.
The user realm endpoint returns a managed-account result for known local accounts. This lets MSAL clients continue to the password grant without a federation or WS-Trust step, while the domain in the response matches the username supplied by the client.
The UserInfo endpoint accepts GET and POST requests. It verifies the Entra token signature and issuer, requires a delegated token with the openid scope, and returns sub plus the profile and email claims requested by the token. It also accepts the Microsoft Graph audience used by local OIDC clients.
Registered endpoint capabilities drive the discovery document. This keeps advertised grants and URLs aligned with the endpoint behavior instead of advertising unsupported features.
Issuer construction keeps discovery and token claims usable from local clients. An explicit issuer setting controls the issuer value when present; otherwise the service derives it from the request base URL and tenant, with v1 and v2 paths using their normal forms. Error links still point to the public Microsoft login host.
References: src/…/EntraServiceHandler.java• L13-31 src/…/EntraServiceHandler.java• L54-72 src/…/InstanceDiscoveryEndpoint.java• L18-27 src/…/InstanceDiscoveryEndpoint.java• L43-63 src/…/InstanceDiscoveryEndpoint.java• L66-85 src/…/InstanceDiscoveryEndpoint.java• L87-123 src/…/UserRealmEndpoint.java• L11-18 src/…/UserRealmEndpoint.java• L36-57 src/…/UserInfoEndpoint.java• L25-88 src/…/UserInfoEndpoint.java• L91-146 src/…/ConfiguredTenantResolver.java• L10-15 src/…/ConfiguredTenantResolver.java• L29-45 src/…/EntraRequest.java• L17-30 src/…/IssuerFactory.java• L7-12 src/…/IssuerFactory.java• L25-51
Token and credential behavior
The token endpoint supports the credential paths that local Azure clients commonly use. A client can send credentials in the form, HTTP Basic authentication, or a client assertion. Client validation is controlled by entra.validate-client-credentials: when it is off, the service accepts unregistered clients for local compatibility; when it is on, it checks the application and its stored secret.
Supported grant behavior is:
client_credentialsreturns an app-only token. The v2 audience comes from the requested{resource}/.defaultscope.passwordreturns a delegated token for the requested username. By default, the password is not checked. Whenentra.validate-user-credentialsis enabled, the username, password, tenant, account state, and password-change state are checked. If the request includesopenid, the response also includes an ID token. A request forclient_info=1receives the account and home-tenant data that MSAL uses to build an account.authorization_codereturns an access token and an OIDC ID token for the user selected during authorization.refresh_tokenrenews a v2 delegated session. It checks the client and both tenant identities, returns a replacement refresh token, and keeps the original token valid until it expires or is revoked.
The authorization-code path auto-approves a seeded local user. It returns a five-minute, single-use code and checks the tenant, client ID, redirect URI, and optional PKCE verifier when the client redeems it. It also carries the original state through the redirect and the original nonce into the ID token. An authorization request without a code challenge remains allowed for local compatibility.
Refresh tokens are opaque to clients and are stored as digests. A confidential client must still provide its client credential when validation is enabled. A standard refresh token lasts 90 days, while a single-page app token lasts one day; renewal extends the standard lifetime but keeps the single-page app expiry fixed. The user and application must still exist when the token is renewed. If user credential validation is enabled, a disabled user or a user who must change a password cannot renew the session.
Access-token audience behavior follows the requested protocol version. v2 delegated and app-only flows use the client or requested resource audience expected by that flow, while v1 flows use the first requested resource scope. ID tokens always use the client application ID as their audience. Issued JWTs carry normal time, tenant, subject, application, and delegated-scope claims. They use RS256 and identify the signing key with kid so clients can resolve it through JWKS. User claims follow the token version: v1 tokens use upn and unique_name, while v2 tokens use preferred_username. OIDC-only scopes do not become resource scopes; delegated tokens retain the openid scope needed by UserInfo where that grant path carries it.
ID tokens add OIDC identity data such as nonce, name, preferred username, and email when those values exist. The nonce comes from the authorization request so a client can match the response to the sign-in attempt.
When client validation is enabled, application secrets are compared against stored password-derived hashes and their validity dates. Client assertions are accepted as a local compatibility path without certificate or federated-credential verification. User passwords use the same protected storage model when directory credential validation is enabled.
Token responses use the normal Bearer response shape. They include optional scope, ID-token, refresh-token, and MSAL account metadata when the request needs them. Unsupported grants and invalid authorization-code, password, or refresh-token exchanges use AADSTS-style error bodies with OAuth error codes, HTTP status values, trace IDs, correlation IDs, timestamps, and error links so MSAL and azure-identity can process them as service responses.
See Entra token flows for the full grant and code-exchange behavior.
References: src/…/TokenEndpoint.java• L18-23 src/…/TokenEndpoint.java• L31-38 src/…/ClientAuthenticator.java• L14-31 src/…/ClientAuthenticator.java• L67-107 src/…/ClientCredentials.java• L9-17 src/…/ClientCredentialsGrant.java• L7-37 src/…/PasswordGrant.java• L9-12 src/…/PasswordGrant.java• L31-56 src/…/AuthorizationCodeGrant.java• L17-21 src/…/AuthorizationCodeGrant.java• L48-119 src/…/RefreshTokenGrant.java• L12-90 src/…/Scopes.java• L9-56 src/…/TokenIssuer.java• L35-58 src/…/TokenIssuer.java• L65-160 src/…/EntraResponses.java• L46-75 src/…/EntraResponses.java• L95-118 src/…/AuthorizeEndpoint.java• L18-23 src/…/AadstsError.java• L15-54
Directory and managed identity state
The Entra directory is shared by the token service and Microsoft Graph. It stores users, groups, applications, service principals, and direct links between them on a per-tenant basis. The typed directory reader gives token and Graph flows a common view of this state, including account status, password-change state, application redirect URIs, service-principal lookup, and credential validity without exposing stored password hashes through user records. Direct group membership is available as a set of group IDs; nested-group membership is not inferred. See Entra directory state for the seed contract and directory lifecycle, and Microsoft Graph integration for the directory-facing API.
Directory records use tenant-scoped objects and alternate-key indexes. Older flat records remain readable as records in the default tenant, but startup does not migrate them in bulk; a write or delete moves the affected record to the tenant-scoped layout. This keeps existing local state usable while new changes use the tenant-aware model.
An optional directory seed file can add applications, users, groups, and direct group membership at startup. The seed is checked before it is applied, so duplicate IDs, duplicate alternate keys, unsupported fields, and unknown group members fail startup instead of creating partial directory state. The built-in development app, user, and group remain available when the seed does not replace them.
Client secrets and user passwords are not kept as plain text when directory objects are written. New writes use salted PBKDF2-derived hashes with the hash parameters stored beside each credential. Existing flat records remain readable for compatibility, while new writes store protected credentials with optional start and end dates. Client authentication uses this application registration state without returning the secret value to clients.
Tenant resolution separates the tenant named in the token issuer from the directory used for local lookups. The configured default tenant handles the aliases common, organizations, and consumers; an unknown tenant ID can receive tokens while its lookups use the default directory.
Managed identity has related control and token surfaces. Its ARM surface manages user-assigned identities and federated identity credentials and exposes system-assigned identity views. An identity reference on another ARM resource must name an existing user-assigned identity before the write continues. Its token surfaces support the IMDS endpoint GET metadata/identity/oauth2/token and the App Service endpoint configured for IDENTITY_ENDPOINT; both resolve one system- or user-assigned identity and return an app-only token for the requested resource.
IMDS requests require the metadata header and a resource. They may select at most one user-assigned identity by client ID, object ID, or resource ID. With no selector, the service uses the configured system-assigned scope rather than inferring an identity from the caller. App Service requests use the configured identity header and accept both mi_res_id and msi_res_id resource-ID selector spellings used by common SDKs. Managed identity responses use string-valued expiry fields and include the identity details expected by Azure credential clients.
Managed identity tokens use the Entra signing key and the local issuer model. They are app-only v1 tokens whose audience is the requested resource and whose xms_mirid claim identifies the selected identity resource. This lets a client obtain a token through IMDS or App Service and use it against services that accept the emulator's Bearer-token path. See Cloud and directory configuration for tenant and request-scope settings.
References: src/…/GraphDirectoryStore.java• L43-63 src/…/GraphDirectoryStore.java• L132-159 src/…/GraphDirectoryStore.java• L182-233 src/…/GraphDirectoryStore.java• L257-328 src/…/GraphDirectoryStore.java• L370-444 src/…/GraphDirectoryStore.java• L489-507 src/…/DirectorySeed.java• L20-102 src/…/DirectorySeed.java• L104-143 src/…/DirectoryReader.java• L18-21 src/…/DirectoryReader.java• L35-73 src/…/DirectoryReader.java• L75-127 src/…/DirectoryReader.java• L129-180 src/…/ConfiguredTenantResolver.java• L10-15 src/…/TenantRef.java• L3-11 src/…/ManagedIdentityHandler.java• L34-48 src/…/ManagedIdentityHandler.java• L291-369 src/…/ManagedIdentityHandler.java• L372-463 src/…/ManagedIdentityStore.java• L20-29 src/…/ManagedIdentityModels.java• L13-35 src/…/UserAssignedIdentityRule.java• L14-19
Key Vault and Managed HSM
Key Vault provides the local data plane for secrets, keys, certificates, and cryptographic operations. Managed HSM shares the key-oriented surface but has its own key namespace and rejects vault-only secret and certificate routes, including when both services use the same account name.
The management plane exposes persistent Azure Resource Manager state for vaults and managed HSMs. Clients can create, read, list, update, and delete these resources at subscription and resource-group scopes, check global name availability, and read the service URIs that point to the data plane. Vault management also supports add, replace, and remove access-policy operations; each operation updates the policy set for the vault in its own resource scope. This management state feeds resource listings and the data-plane fallback used by SDK setup flows. The fallback uses the single vault name when exactly one vault exists; otherwise it uses a neutral default account. The data plane itself does not require a matching ARM record for the addressed vault or HSM name.
Vault deletion can create a soft-deleted ARM record when soft delete is enabled. The default retention is 90 days, the request can set the retention period, and a later createMode: recover request can restore the vault before the deleted record is purged. A normal create or update for the same name also clears the deleted record, while recovery merges request values over the deleted vault. Managed HSM deletion is not retained in a deleted-resource list. The data plane remains independent of these ARM records.
Clients can reach the data plane through Azure-style vault or HSM hosts and emulator account markers. An unauthenticated request receives a Bearer challenge with a vault or Managed HSM resource, which Azure SDK clients can use to retry the operation with an authorization header. A root probe then identifies the vault or HSM resource for provider and SDK setup flows. Managed HSM host matching also accepts an authority with a port, so local HSM endpoints keep their service type.
The main resource behavior is:
- Secrets support versioned read and write operations, backup, soft delete, recovery, and purge.
- Keys support RSA, EC, and symmetric material, version and rotation state, backup and restore, soft delete, and crypto operations such as sign, verify, encrypt, decrypt, wrap, and unwrap.
- Certificates are local self-signed resources linked to their key and secret versions.
- Data-plane deleted resources remain blocked by a seven-day recovery window until recovery or purge.
Private and symmetric key material stays in the service. Responses expose only the public data needed by clients, while cryptographic operations use the stored material. ARM resource documents keep the requested vault settings, tenant, SKU, tags, access policies, and generated data-plane URI so management clients can discover and reuse the resource. Secret values used by local service integrations resolve only when the current secret exists and is enabled; deleted secrets keep stored versions until purge but do not resolve through that access path. See Key Vault secret access behavior for the challenge and secret lifecycle flow.
References: src/…/KeyVaultArmSurface.java• L16-61 src/…/KeyVaultArmService.java• L40-56 src/…/KeyVaultArmService.java• L151-199 src/…/KeyVaultArmService.java• L238-279 src/…/KeyVaultArmService.java• L298-375 src/…/KeyVaultArmService.java• L405-448 src/…/KeyVaultArmService.java• L464-537 src/…/KeyVaultArmService.java• L541-585 src/…/KeyVaultArmService.java• L593-610 src/…/VaultAccessPolicies.java• L11-21 src/…/VaultAccessPolicies.java• L66-96 src/…/KeyVaultHandler.java• L34-126 src/…/KeyVaultHandler.java• L129-197 src/…/KeyVaultHandler.java• L203-210 src/…/KeyVaultHandler.java• L418-480 src/…/KeyVaultHandler.java• L500-671
Shared token trust and local authentication
Entra and managed identity issue tokens under one signing key and publish the corresponding JWKS. This gives SDKs and external test clients a realistic issuer, audience, claim, and key-discovery model.
When strict-tokens is enabled, the ARM request gate first checks client Bearer tokens before other ARM rules run. It accepts only JWTs with the emulator's RS256 signing key, a valid lifetime, an issuer that belongs to the token tenant, and an audience accepted by the target cloud. The check allows five minutes of clock skew for exp and nbf; an explicit Entra issuer must match exactly, while a derived issuer must use the token tenant in its path. A token with a missing header, invalid contents, or an unsupported audience receives an Azure-shaped authentication error.
After token validation, the ARM gate can check that the token tenant owns the named subscription. With strict token handling enabled, a mismatch returns InvalidAuthenticationTokenTenant before subscription state is registered or changed. With strict handling disabled, the path remains authoritative and a mismatch is logged for local compatibility. An unknown subscription can be registered on first use by a matching token tenant; requests made without a subscription and internal emulator requests bypass this comparison.
The ARM gate accepts the cloud's ARM audiences and, for emulator host names, the request's own base URL. It does not add that base URL when the request uses a real Azure or Microsoft host. Internal emulator requests bypass the gate because their caller was checked at entry and work such as a template deployment can outlive the token that started it. A refused request does not register a subscription or write an Activity Log entry.
The UserInfo endpoint independently verifies the token signature, issuer, time claims, delegated identity type, and audience before it returns OIDC claims. Ordinary non-ARM service requests still use the less strict local Bearer verifier, which accepts any non-empty Bearer token without checking its signature, issuer, audience, or expiry. The token issuer and JWKS therefore support client compatibility and manual validation, while ordinary service requests are not a security boundary for local development. See Core routing and auth for the broader request-authentication path.
Group IDs are not embedded in issued tokens. Clients that need direct group membership use the separate Microsoft Graph operation, which reads the same Entra user and group state. See Microsoft Graph integration for that directory-facing behavior.
References: src/…/TokenRule.java• L23-39 src/…/TokenRule.java• L64-113 src/…/TenantMatchRule.java• L19-29 src/…/TenantMatchRule.java• L64-113 src/…/TokenValidator.java• L23-31 src/…/TokenValidator.java• L65-101 src/…/TokenValidator.java• L115-164 src/…/UserInfoEndpoint.java• L61-88 src/…/UserInfoEndpoint.java• L91-135 src/…/BearerTokenVerifier.java• L1-80 src/…/AuthPipeline.java• L1-100 src/…/TokenIssuer.java• L109-160 src/…/GraphServiceHandler.java• L1-120
Change checklist
When these files or sections are changed, remember to consider these:
- If a grant handler changes, keep the token endpoint dispatch and discovery
grant_types_supportedlist aligned. - If an Entra endpoint path changes, update both its matching rule and the discovery URL that clients use to find it.
- If instance discovery changes, keep the request host, port, preferred authority, aliases, tenant path, API version, and MSAL authority resolution behavior aligned.
- If UserInfo validation or claims change, keep its discovery advertisement, accepted audiences, delegated-scope rules, and signed-token checks aligned.
- If user realm discovery changes, keep its managed-account response aligned with the password-grant path used by MSAL clients.
- If issuer or tenant-alias behavior changes, check discovery documents, token
issclaims, authorization-code tenant checks, UserInfo issuer checks, and client authority construction together. - If authorization-code state changes, preserve single-use redemption and the tenant, client, redirect URI, PKCE,
state, andnoncecontract. - If refresh-token state changes, keep v2-only use, tenant and client binding, replacement behavior, SPA and confidential-client expiry rules, user-state checks, and AADSTS errors aligned.
- If client validation changes, keep the validation switch, accepted credential forms, application lookup, secret hashing and validity dates, and AADSTS errors aligned.
- If user credential validation changes, keep the password-grant switch, directory password hash checks, account and password-change checks, refresh-token checks, and user error codes aligned.
- If token response fields change, keep
openid, ID-token,offline_access, refresh-token,client_info, and MSAL account behavior aligned for password and authorization-code grants. - If token claims or audience rules change, check v1 and v2 access tokens, OIDC ID tokens, managed identity tokens, UserInfo audiences, JWKS consumers, and strict ARM audiences together.
- If token-version claim names change, keep v1
upnandunique_name, v2preferred_username, ID-token OIDC claims, and client parsing behavior aligned. - If directory storage or seeded Entra IDs change, update zero-setup credential use and any Graph membership lookup that depends on the same fixtures.
- If directory seed validation changes, keep seed fields, object IDs, alternate keys, and group-member references consistent with Graph lookups.
- If directory credential storage or
DirectoryReaderviews change, keep PBKDF2 hash fields, legacy flat-record reads, write-time protection, credential validity dates, redirect URI checks, and service-principal lookup aligned. - If the shared signing-key behavior changes, keep Entra tokens, managed identity tokens, UserInfo verification, strict ARM validation, and JWKS consumers aligned across restarts.
- If strict ARM token validation changes, keep the strict-tokens switch, gate order, internal-request bypass, issuer rules, clock skew, cloud audiences, emulator base URL, and Azure-shaped refusal codes aligned.
- If ARM tenant matching changes, keep token validation order, subscription first-use ownership, strict and compatibility modes, synthetic internal requests, and tenant refusal codes aligned.
- If managed identity ARM behavior changes, keep identity and federated-credential resource shapes, selector indexes, system-assigned views, and cross-resource identity validation aligned.
- If managed identity endpoint behavior changes, keep IMDS and App Service headers, selector rules, configured system-assigned scope,
xms_mirid, string-valued response fields, and resource audiences aligned with their SDK clients. - If Key Vault ARM behavior changes, keep provider registration, global name checks, vault or HSM URIs, resource listings, persistent ARM state, and data-plane fallback selection aligned.
- If Key Vault access-policy behavior changes, keep add, replace, remove matching rules and the stored vault policy list aligned.
- If Key Vault data-plane behavior changes, preserve the Bearer challenge, vault-versus-HSM separation, host-with-port handling, and SDK-parsable resource IDs.
- If Key Vault ARM persistence or fallback behavior changes, keep resource listings, the single-vault account selection, neutral multi-vault fallback, and data-plane host routing aligned.
- If Key Vault ARM deletion or recovery behavior changes, keep soft-delete settings, retention dates,
createMode: recover, same-name recreate behavior, purge protection, deleted-vault listings, and managed-HSM deletion behavior aligned. - If Key Vault data-plane lifecycle behavior changes, keep version state, certificate-linked resources, crypto checks, and the seven-day soft-delete contract aligned.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| Instance discovery drops the local port or returns a different preferred host | MSAL resolves token requests to the wrong authority | Preserve the request authority and port in preferred_network and preferred_cache |
| Client validation is off when a test expects app registration or secret checks | An unknown client can still receive a token | Enable entra.validate-client-credentials for validation tests |
| Client validation is on and the client secret does not match the application record or its validity dates | The token request returns an AADSTS invalid-client error | Use the registered secret value within its start and end dates and the correct tenant authority |
| User credential validation is on and the username, password, tenant, account state, or password-change state is invalid | The password grant returns an AADSTS credential, disabled-user, or password-change error | Enable the setting only when the seed contains matching protected user credentials and valid account state |
| An authorization code is reused or redeemed with a different tenant, client, redirect URI, or PKCE verifier | The exchange returns invalid_grant and does not issue tokens | Codes are consumed once and the exchange checks its expiry and bindings |
| A refresh token is used with the wrong client, tenant, user state, or protocol version | The exchange returns an AADSTS invalid-grant error | Use the token at its v2 authority before its SPA or standard lifetime ends |
| A single-page app refresh token is expected to live for the standard 90-day period | Renewal fails after one day even when the replacement path is used | Treat the one-day SPA lifetime as fixed |
| Discovery advertises a path or grant that no longer has a matching endpoint | MSAL or an Azure SDK fails before token acquisition | Keep endpoint matching and capability advertisement in the same change |
A UserInfo request lacks a valid signed delegated token or the openid scope | UserInfo returns 401 invalid_token or 403 insufficient_scope | Request a signed user token with the required OIDC scope and accepted audience |
| A password client cannot parse the user realm response or the response does not identify a managed account | MSAL4J can stop before it sends the password grant | Return the managed realm shape and continue to the token endpoint |
The issuer in discovery does not match the token iss claim | MSAL authority validation or UserInfo issuer validation rejects the token | Derive both values through the same issuer rules or set one explicit issuer |
| The token tenant differs from the named subscription tenant while strict token handling is enabled | ARM returns InvalidAuthenticationTokenTenant before subscription state or activity is written | Request the token from the subscription's tenant authority |
The strict ARM gate receives no Bearer header or a token with a bad signature, lifetime, issuer, or kid | The ARM request returns an Azure-shaped authentication failure before resource rules run | Use a token issued by this emulator and keep its lifetime and issuer aligned with discovery |
| The strict ARM token audience is not an accepted cloud ARM audience or emulator base URL | The ARM request returns InvalidAuthenticationTokenAudience | Request the token for the target cloud's ARM resource or the emulator base URL |
| A strict ARM request uses a real Azure or Microsoft host with only the emulator base URL as its audience | The request is rejected even though the base URL is accepted for emulator hosts | Use the cloud ARM audience when the request authority is a real Azure or Microsoft host |
| An internal ARM request is changed to use client headers or bypasses the entry gate contract | Template work can fail after the caller's token expires or can be checked twice | Keep synthetic internal requests separate from client requests and preserve the caller check at entry |
| The signing key cannot be loaded or persisted | A new ephemeral key can invalidate cached JWKS assumptions after restart | Treat the logged fallback as a local-environment fault and refresh discovery or tokens |
| A directory seed contains duplicate IDs, alternate keys, unsupported fields, or unknown group members | Startup fails before the service is ready | Correct the seed shape and references before startup |
| A stored secret hash is malformed or uses an unsupported hash format | The credential matches nothing and token or password validation fails | Rewrite the directory object with a supported protected credential |
| A credential validity timestamp is malformed | The unreadable bound is ignored and the credential can remain usable outside its intended window | Store valid ISO 8601 date-time bounds or remove the bound intentionally |
| An old flat directory record is changed by a path that assumes all records are tenant-keyed | The change can miss the legacy record or leave stale alternate data | Use the directory store's lookup and write behavior rather than addressing storage keys directly |
| The IMDS request has more than one identity selector or lacks the metadata header | Managed identity token acquisition returns a client error | Send Metadata: true and select at most one of client_id, object_id, or msi_res_id |
| An App Service request lacks the configured identity header or uses an unknown identity selector | Managed identity token acquisition returns an error | Send the configured X-IDENTITY-HEADER and select one known identity |
| No managed identity selector is supplied but the configured system-assigned scope is not the intended resource | The token identifies the configured emulator identity rather than the caller's expected identity | Set system-assigned-scope to the resource that owns the local identity |
| Another ARM resource references a missing user-assigned identity | The ARM write returns FailedIdentityOperation before the resource is stored | Create the identity first or remove the reference |
| A Key Vault client does not retry after the unauthenticated probe | The client stops at the initial 401 and never performs the data operation | Use challenge-based Azure SDK authentication or send a Bearer header |
| A client sends secrets or certificates to Managed HSM | The request returns 404 even when a same-named vault resource exists | Use a Key Vault endpoint for vault-only resource types |
| A Managed HSM authority includes a port but the route does not preserve its HSM flavor | The request can be treated as a vault request or expose the wrong root probe | Keep authority matching separate from port parsing and retain the HSM marker |
| A key operation uses an unsupported algorithm, key type, operation, or key state | Key Vault returns an error and does not perform the operation | Match the operation to the key and keep the key enabled and within its time bounds |
| A vault with purge protection is purged through the ARM deleted-vault endpoint | ARM returns 409 Conflict and keeps the deleted record | Disable purge protection for test data or use the service-side purge path |
| A client expects a deleted managed HSM to appear in the deleted-resource list | The list is empty because managed HSM deletion is not retained | Treat managed HSM deletion as final in the ARM emulator |
| A vault is recreated by name while a deleted-vault record still exists | The deleted record is cleared and cannot later be recovered | Use createMode: recover when the deleted vault state must be restored |
| A local service reads a deleted or disabled secret through the vault reference path | No secret value is returned even if version data remains in storage | Restore the secret or enable its current version before the dependent service reads it |
Key files
| File | Why to read it |
|---|---|
| src/…/EntraServiceHandler.java | Entra tenant resolution and endpoint dispatch |
| src/…/InstanceDiscoveryEndpoint.java | MSAL instance discovery, authority aliases, local ports, and tenant discovery URL selection |
| src/…/UserRealmEndpoint.java | Username realm discovery for password-based clients |
| src/…/UserInfoEndpoint.java | OIDC UserInfo discovery, token checks, and returned claims |
| src/…/ConfiguredTenantResolver.java | Default tenant and authority alias behavior |
| src/…/IssuerFactory.java | Issuer and error-link values used by discovery and tokens |
| src/…/TokenEndpoint.java | Token endpoint input handling, client authentication, and grant dispatch |
| src/…/TokenRule.java | Strict ARM token gate order, audience selection, and Azure-shaped refusal responses |
| src/…/TenantMatchRule.java | Subscription tenant matching after token validation and first-use ownership |
| src/…/TokenValidator.java | JWT signature, lifetime, issuer, and audience checks for strict ARM requests |
| src/…/PasswordGrant.java | Password-grant compatibility mode, optional user checks, and MSAL account response fields |
| src/…/AuthorizationCodeGrant.java | Code redemption, PKCE checks, and access or ID token response |
| src/…/RefreshTokenGrant.java | Refresh-token binding, user-state checks, expiry, renewal, and replacement response |
| src/…/TokenIssuer.java | Shared JWT claims, version-specific user claims, deterministic identity IDs, and signing behavior |
| src/…/EntraResponses.java | Token response and AADSTS error response shapes |
| src/…/AadstsError.java | Stable OAuth and AADSTS error contracts |
| src/…/ClientAuthenticator.java | Configurable application and client-secret validation |
| src/…/Scopes.java | Audience and delegated-scope handling |
| src/…/AuthorizeEndpoint.java | Local authorization-code start and redirect behavior |
| src/…/DirectorySeed.java | Startup directory fixtures and seed validation |
| src/…/GraphDirectoryStore.java | Tenant-scoped directory state, legacy record compatibility, seeded fixtures, links, and credential protection |
| src/…/DirectoryReader.java | Shared typed view of users, groups, applications, service principals, redirect URIs, and credential validity |
| src/…/SecretHasher.java | Protected storage and comparison of client secrets and user passwords |
| src/…/EntraStore.java | Tenant state, authorization codes, refresh state, and reset behavior |
| src/…/ManagedIdentityHandler.java | Managed identity ARM state, identity selectors, IMDS behavior, App Service token behavior, and system-assigned scope |
| src/…/ManagedIdentityStore.java | User-assigned identity and federated credential state used by ARM and token selectors |
| src/…/ManagedIdentityModels.java | Managed identity resource shapes returned to ARM clients |
| src/…/ManagedIdentityArmSurface.java | Managed identity ARM resource types and name rules |
| src/…/UserAssignedIdentityRule.java | Cross-resource validation of user-assigned identity references |
| src/…/KeyVaultArmSurface.java | Key Vault and Managed HSM ARM resource types and name rules |
| src/…/KeyVaultArmService.java | Key Vault ARM state, management endpoints, persistence, soft-delete and recovery behavior, URIs, and data-plane fallback selection |
| src/…/VaultAccessPolicies.java | Vault access-policy add, replace, and remove behavior |
| src/…/KeyVaultHandler.java | Vault and HSM routing, challenge behavior, host handling, resource dispatch, and secret lifecycle |
| src/…/BearerTokenVerifier.java | Local non-ARM Bearer-token acceptance boundary |