Introducing a new way to review your PRs.

Read the announcement

floci-io / floci-az

Light, fluffy, and always free - Local Azure Emulator

View on GitHub

27 documents · Updated Nov 23, 2026

docs / azure-identity-security

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 familyClient-facing purpose
OpenID configurationDescribes the issuer, token endpoint, authorization endpoint, supported grants, JWKS URL, and UserInfo endpoint.
JWKSPublishes the public key used to check emulator-issued JWTs.
TokenIssues v1 or v2 access tokens for supported grant types.
AuthorizeStarts the local authorization-code flow and redirects the client back with a code.
User realmIdentifies a username as a managed cloud account before a password grant.
Instance discoveryMaps the authority host to the local tenant discovery endpoint before token requests.
UserInfoReturns 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_credentials returns an app-only token. The v2 audience comes from the requested {resource}/.default scope.
  • password returns a delegated token for the requested username. By default, the password is not checked. When entra.validate-user-credentials is enabled, the username, password, tenant, account state, and password-change state are checked. If the request includes openid, the response also includes an ID token. A request for client_info=1 receives the account and home-tenant data that MSAL uses to build an account.
  • authorization_code returns an access token and an OIDC ID token for the user selected during authorization.
  • refresh_token renews 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_supported list 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 iss claims, 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, and nonce contract.
  • 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 upn and unique_name, v2 preferred_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 DirectoryReader views 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

TriggerConsequenceGuard
Instance discovery drops the local port or returns a different preferred hostMSAL resolves token requests to the wrong authorityPreserve the request authority and port in preferred_network and preferred_cache
Client validation is off when a test expects app registration or secret checksAn unknown client can still receive a tokenEnable entra.validate-client-credentials for validation tests
Client validation is on and the client secret does not match the application record or its validity datesThe token request returns an AADSTS invalid-client errorUse 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 invalidThe password grant returns an AADSTS credential, disabled-user, or password-change errorEnable 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 verifierThe exchange returns invalid_grant and does not issue tokensCodes 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 versionThe exchange returns an AADSTS invalid-grant errorUse 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 periodRenewal fails after one day even when the replacement path is usedTreat the one-day SPA lifetime as fixed
Discovery advertises a path or grant that no longer has a matching endpointMSAL or an Azure SDK fails before token acquisitionKeep endpoint matching and capability advertisement in the same change
A UserInfo request lacks a valid signed delegated token or the openid scopeUserInfo returns 401 invalid_token or 403 insufficient_scopeRequest 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 accountMSAL4J can stop before it sends the password grantReturn the managed realm shape and continue to the token endpoint
The issuer in discovery does not match the token iss claimMSAL authority validation or UserInfo issuer validation rejects the tokenDerive 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 enabledARM returns InvalidAuthenticationTokenTenant before subscription state or activity is writtenRequest 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 kidThe ARM request returns an Azure-shaped authentication failure before resource rules runUse 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 URLThe ARM request returns InvalidAuthenticationTokenAudienceRequest 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 audienceThe request is rejected even though the base URL is accepted for emulator hostsUse 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 contractTemplate work can fail after the caller's token expires or can be checked twiceKeep synthetic internal requests separate from client requests and preserve the caller check at entry
The signing key cannot be loaded or persistedA new ephemeral key can invalidate cached JWKS assumptions after restartTreat 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 membersStartup fails before the service is readyCorrect the seed shape and references before startup
A stored secret hash is malformed or uses an unsupported hash formatThe credential matches nothing and token or password validation failsRewrite the directory object with a supported protected credential
A credential validity timestamp is malformedThe unreadable bound is ignored and the credential can remain usable outside its intended windowStore 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-keyedThe change can miss the legacy record or leave stale alternate dataUse 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 headerManaged identity token acquisition returns a client errorSend 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 selectorManaged identity token acquisition returns an errorSend 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 resourceThe token identifies the configured emulator identity rather than the caller's expected identitySet system-assigned-scope to the resource that owns the local identity
Another ARM resource references a missing user-assigned identityThe ARM write returns FailedIdentityOperation before the resource is storedCreate the identity first or remove the reference
A Key Vault client does not retry after the unauthenticated probeThe client stops at the initial 401 and never performs the data operationUse challenge-based Azure SDK authentication or send a Bearer header
A client sends secrets or certificates to Managed HSMThe request returns 404 even when a same-named vault resource existsUse a Key Vault endpoint for vault-only resource types
A Managed HSM authority includes a port but the route does not preserve its HSM flavorThe request can be treated as a vault request or expose the wrong root probeKeep authority matching separate from port parsing and retain the HSM marker
A key operation uses an unsupported algorithm, key type, operation, or key stateKey Vault returns an error and does not perform the operationMatch 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 endpointARM returns 409 Conflict and keeps the deleted recordDisable 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 listThe list is empty because managed HSM deletion is not retainedTreat managed HSM deletion as final in the ARM emulator
A vault is recreated by name while a deleted-vault record still existsThe deleted record is cleared and cannot later be recoveredUse createMode: recover when the deleted vault state must be restored
A local service reads a deleted or disabled secret through the vault reference pathNo secret value is returned even if version data remains in storageRestore the secret or enable its current version before the dependent service reads it

Key files

FileWhy to read it
src/…/EntraServiceHandler.javaEntra tenant resolution and endpoint dispatch
src/…/InstanceDiscoveryEndpoint.javaMSAL instance discovery, authority aliases, local ports, and tenant discovery URL selection
src/…/UserRealmEndpoint.javaUsername realm discovery for password-based clients
src/…/UserInfoEndpoint.javaOIDC UserInfo discovery, token checks, and returned claims
src/…/ConfiguredTenantResolver.javaDefault tenant and authority alias behavior
src/…/IssuerFactory.javaIssuer and error-link values used by discovery and tokens
src/…/TokenEndpoint.javaToken endpoint input handling, client authentication, and grant dispatch
src/…/TokenRule.javaStrict ARM token gate order, audience selection, and Azure-shaped refusal responses
src/…/TenantMatchRule.javaSubscription tenant matching after token validation and first-use ownership
src/…/TokenValidator.javaJWT signature, lifetime, issuer, and audience checks for strict ARM requests
src/…/PasswordGrant.javaPassword-grant compatibility mode, optional user checks, and MSAL account response fields
src/…/AuthorizationCodeGrant.javaCode redemption, PKCE checks, and access or ID token response
src/…/RefreshTokenGrant.javaRefresh-token binding, user-state checks, expiry, renewal, and replacement response
src/…/TokenIssuer.javaShared JWT claims, version-specific user claims, deterministic identity IDs, and signing behavior
src/…/EntraResponses.javaToken response and AADSTS error response shapes
src/…/AadstsError.javaStable OAuth and AADSTS error contracts
src/…/ClientAuthenticator.javaConfigurable application and client-secret validation
src/…/Scopes.javaAudience and delegated-scope handling
src/…/AuthorizeEndpoint.javaLocal authorization-code start and redirect behavior
src/…/DirectorySeed.javaStartup directory fixtures and seed validation
src/…/GraphDirectoryStore.javaTenant-scoped directory state, legacy record compatibility, seeded fixtures, links, and credential protection
src/…/DirectoryReader.javaShared typed view of users, groups, applications, service principals, redirect URIs, and credential validity
src/…/SecretHasher.javaProtected storage and comparison of client secrets and user passwords
src/…/EntraStore.javaTenant state, authorization codes, refresh state, and reset behavior
src/…/ManagedIdentityHandler.javaManaged identity ARM state, identity selectors, IMDS behavior, App Service token behavior, and system-assigned scope
src/…/ManagedIdentityStore.javaUser-assigned identity and federated credential state used by ARM and token selectors
src/…/ManagedIdentityModels.javaManaged identity resource shapes returned to ARM clients
src/…/ManagedIdentityArmSurface.javaManaged identity ARM resource types and name rules
src/…/UserAssignedIdentityRule.javaCross-resource validation of user-assigned identity references
src/…/KeyVaultArmSurface.javaKey Vault and Managed HSM ARM resource types and name rules
src/…/KeyVaultArmService.javaKey Vault ARM state, management endpoints, persistence, soft-delete and recovery behavior, URIs, and data-plane fallback selection
src/…/VaultAccessPolicies.javaVault access-policy add, replace, and remove behavior
src/…/KeyVaultHandler.javaVault and HSM routing, challenge behavior, host handling, resource dispatch, and secret lifecycle
src/…/BearerTokenVerifier.javaLocal non-ARM Bearer-token acceptance boundary