--- title: "Microsoft Entra account takeover protection | Darwinium" slug: "microsoft-entra-native" description: "Integrate Darwinium with Microsoft Entra External ID native authentication using CloudFront, Azure Front Door and risk-based MFA." updated: 2026-10-16T05:49:19Z published: 2026-10-16T05:49:19Z canonical: "docs.darwinium.com/microsoft-entra-native" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.darwinium.com/llms.txt > Use this file to discover all available pages before exploring further. # Microsoft Entra Darwinium helps protect Microsoft Entra External ID customer sign-ins against account takeover by evaluating authentication traffic at the edge. This reference deployment uses **CloudFront and Azure Front Door** to route native authentication requests through a Darwinium journey. Darwinium can allow or reject a request, or request an Entra Conditional Access authentication context for MFA. The application must use the protected hostname and handle Entra's MFA and redirect responses. The worked example uses **email and password with email OTP as the second factor**; it is not a workforce SSO configuration guide. > **Who this is for.** You already have an Entra External ID (CIAM) tenant with native authentication working, and you have AWS available for CloudFront. You may or may not already have Azure Front Door — the guide branches at [Part A](/docs/microsoft-entra-native#part-a-azure-front-door). --- ## Contents 1. [What this delivers](/docs/microsoft-entra-native#1-what-this-delivers) 2. [Why the architecture looks like this](/docs/microsoft-entra-native#2-why-the-architecture-looks-like-this) 3. [Before you start](/docs/microsoft-entra-native#3-before-you-start) 4. [Part A — Azure Front Door](/docs/microsoft-entra-native#part-a-azure-front-door) 5. [Part B — CloudFront and the Darwinium workers](/docs/microsoft-entra-native#part-b-cloudfront-and-the-darwinium-workers) 6. [Part C — Entra configuration for step-up](/docs/microsoft-entra-native#part-c-entra-configuration-for-step-up) 7. [Part D — the Darwinium journey](/docs/microsoft-entra-native#part-d-the-darwinium-journey) 8. [The client-side flow](/docs/microsoft-entra-native#8-the-client-side-flow) 9. [Verification](/docs/microsoft-entra-native#9-verification) 10. [Operating this in production](/docs/microsoft-entra-native#10-operating-this-in-production) 11. [Troubleshooting](/docs/microsoft-entra-native#11-troubleshooting) 12. [Appendix: parameters](/docs/microsoft-entra-native#12-appendix-parameters) --- ## 1. What this delivers Darwinium evaluates a journey on each native-auth request and decides the outcome of the `/token` call: | Outcome | What the user sees | Mechanism | | --- | --- | --- | | **Allow** | Normal sign-in, tokens issued | Request forwarded unchanged | | **Step-up** | Challenged for a second factor | Darwinium injects a `claims` parameter requesting authentication context `c3`; Conditional Access enforces MFA | | **Reject** | "Invalid username or password" | Darwinium terminates the request at the edge and returns a 400 — Entra is never called | The example uses a generic authentication error for rejects. Keep detailed decision reasons in restricted diagnostic logs rather than returning them to the caller. --- ## 2. Why the architecture looks like this The reference architecture keeps the public journey hostname separate from the hostname expected by Entra: - **Entra origin:** use `Host: <tenant-name>.ciamlogin.com` for the origin configuration shown here. An incorrect origin Host can cause routing or authentication errors. - **Darwinium** matches journey steps on the **incoming** Host. If the worker does not see the hostname the journey is bound to, it logs `no steps match` and passes the traffic through untouched. - **CloudFront's origin request policy is binary.** You either forward the viewer's Host, or you let the origin's Host be used. There is no way to set an arbitrary Host, and custom origin headers cannot override it. The reference deployment observed these results with the two managed origin-request policies: | Origin request policy | Darwinium sees its host? | Entra serves the API? | | --- | --- | --- | | `AllViewer` | ✅ steps match | ❌ 502 | | `AllViewerExceptHostHeader` | ❌ `no steps match` | ✅ 200 | Azure Front Door supplies the explicit **origin host header** in this CloudFront reference architecture. Darwinium sees the public hostname while the Entra origin receives its expected hostname. Confirm the corresponding routing requirements if you use a different CDN integration. ![Architecture: client to CloudFront to Front Door to Entra, showing the Host header at each hop](https://cdn.document360.io/db6f7316-640d-4099-b5a1-b01b4dbd17fc/Images/Documentation/diagram-01-architecture.png?sv=2026-02-06&spr=https&st=2026-12-01T03%3A44%3A22Z&se=2026-12-01T04%3A44%3A22Z&sr=b&sp=r&sig=%2B40K%2FBkg6d0aR5iBGdCx7Y4aj%2BbfseO19nkQ5eO56yQ%3D) > **If you already run Azure Front Door**, you do not need a second profile — you need an origin, origin group and route configured as in [Part A](/docs/microsoft-entra-native#part-a-azure-front-door), and the tenant-side custom URL domain registration. Skip the profile creation. ### Register the Front Door custom domain In this deployment, configure a verified custom URL domain in the Entra external tenant as well as the Front Door origin Host header. Host rewriting alone does not complete the custom-domain registration. An unverified routing configuration can return: ```http HTTP/2 400 {"error":"server_error", "error_description":"AADSTS399265: Request was routed from an invalid domain which is not verified.", "error_codes":[399265]} ``` Follow [Microsoft's custom URL domain setup](https://learn.microsoft.com/en-us/entra/external-id/customers/how-to-custom-url-domain) and check both domain verification and custom URL domain association. **Consequence: the custom URL domain registration in [Part A.2](/docs/microsoft-entra-native#a-2-register-the-domain-on-the-entra-tenant) is mandatory.** --- ## 3. Before you start ### You need | Requirement | Details | | --- | --- | | Entra External ID tenant | Native authentication already working, and a **linked Azure subscription** | | Azure | Rights to create a Front Door profile; Global Administrator on the External ID tenant | | AWS | Ability to create a CloudFront distribution, ACM certificates in **us-east-1**, and cross-account IAM roles | | DNS | Control of the public hostname you will expose, e.g. `entra.<customer-domain>` | | Darwinium | Portal access to create an edge target and deploy a journey | ### Check the tenant's linked subscription first Registering a custom URL domain requires the External ID tenant to be linked to an Azure subscription. **Check this in the Entra admin center overview under *Linked Subscription* before concluding the tenant has none.** A subscription warning from `az login` describes the subscriptions visible to that CLI session. Check the External ID tenant's billing link and the Azure account's resource permissions separately. If the portal and CLI disagree about your role, verify the current directory, subscription and role assignment. ### A note on tooling The guide combines Azure CLI examples, Microsoft Graph request examples and portal steps. Replace all angle-bracket placeholders before running commands. Graph requests require an access token with the permissions and administrative role required by that endpoint. Screenshots illustrate the reference deployment. --- ## Part A — Azure Front Door > **Already have Front Door?** Skip to [A.1](/docs/microsoft-entra-native#a-1-create-the-origin-with-the-host-rewrite) and add an origin group, origin and route to your existing profile. Register the resource provider if it has never been used on the subscription: ```bash az provider register --namespace Microsoft.Cdn az provider show -n Microsoft.Cdn --query registrationState -o tsv # -> Registered ``` Create the profile and endpoint. The resource group location is metadata only — Front Door itself is Global. ```bash RG=rg-dwn-entra-afd P=afd-dwn-entra az group create -n $RG -l '' az afd profile create -g $RG --profile-name $P --sku Standard_AzureFrontDoor az afd endpoint create -g $RG --profile-name $P \ --endpoint-name dwn-entra --enabled-state Enabled ``` ![Front Door profile overview showing SKU Standard, Front Door ID, endpoint hostname, custom domain and origin group](https://cdn.document360.io/db6f7316-640d-4099-b5a1-b01b4dbd17fc/Images/Documentation/azure-01-afd-overview.png?sv=2026-02-06&spr=https&st=2026-12-01T03%3A44%3A22Z&se=2026-12-01T04%3A44%3A22Z&sr=b&sp=r&sig=Hj3IUs7yh3E1URJLugefpKe5V9avY2RK%2Fh5MwSwQ5VA%3D) ### A.1 Create the origin with the Host rewrite ```bash az afd origin-group create -g $RG --profile-name $P \ --origin-group-name og-ciamlogin \ --probe-request-type GET --probe-protocol Https \ --probe-interval-in-seconds 120 --probe-path / \ --sample-size 4 --successful-samples-required 3 \ --additional-latency-in-milliseconds 50 ``` ![Origin group configuration with health probe settings](https://cdn.document360.io/db6f7316-640d-4099-b5a1-b01b4dbd17fc/Images/Documentation/azure-03-origin-group.png?sv=2026-02-06&spr=https&st=2026-12-01T03%3A44%3A22Z&se=2026-12-01T04%3A44%3A22Z&sr=b&sp=r&sig=pV%2B6jETLPSBLFtoYNNSD16FNmdh2rBttlmVMtNUsc1E%3D) Set the origin Host header explicitly. `--origin-host-header` is the Host rewrite CloudFront's binary origin request policy cannot express: ```bash az afd origin create -g $RG --profile-name $P \ --origin-group-name og-ciamlogin --origin-name ciamlogin \ --host-name '.ciamlogin.com' \ --origin-host-header '.ciamlogin.com' \ --http-port 80 --https-port 443 --priority 1 --weight 1000 \ --enabled-state Enabled --enforce-certificate-name-check true ``` ![Origin configuration showing Host name and Origin host header both set to the ciamlogin hostname](https://cdn.document360.io/db6f7316-640d-4099-b5a1-b01b4dbd17fc/Images/Documentation/azure-04-origin-host-header.png?sv=2026-02-06&spr=https&st=2026-12-01T03%3A44%3A22Z&se=2026-12-01T04%3A44%3A22Z&sr=b&sp=r&sig=lfgJJRByqXfLUuwdUGJ3Re5t1UutTybHZ4e5xNz9JEI%3D) Then the route. Note there is **no `--enable-caching` flag** — see the warning below. ```bash az afd route create -g $RG --profile-name $P \ --endpoint-name dwn-entra --route-name default-route \ --origin-group og-ciamlogin \ --supported-protocols Https --patterns-to-match "/*" \ --forwarding-protocol MatchRequest \ --link-to-default-domain Enabled --https-redirect Disabled \ --enabled-state Enabled ``` ![Route configuration showing patterns /*, HTTPS only, origin group, and Enable caching unchecked](https://cdn.document360.io/db6f7316-640d-4099-b5a1-b01b4dbd17fc/Images/Documentation/azure-06-route.png?sv=2026-02-06&spr=https&st=2026-12-01T03%3A44%3A22Z&se=2026-12-01T04%3A44%3A22Z&sr=b&sp=r&sig=VTbrUzrcLrMPE%2BaI5o8Oj5%2Fmr5m%2F%2Brj8A4IuHEUQoTw%3D) > **Never enable caching** > > > `az afd route show` should report `cacheConfiguration: null`. Keep authentication responses uncached at both CDN layers; never allow a shared cache to reuse a user-specific authentication response. #### Wait for route deployment Check deployment status after creating the route: ```bash az afd route show -g "$RG" --profile-name "$P" --endpoint-name dwn-entra \ --route-name default-route \ --query "{prov:provisioningState,deploy:deploymentStatus}" ``` Edge propagation can take several minutes. Complete the domain registration and custom-domain association below before testing the full authentication flow. A 400 response alone does not prove that the integration is configured correctly. ### A.2 Register the domain on the Entra tenant Use the supported portal workflow to register the public hostname: 1. In the Entra admin center, select your external tenant. 2. Add the hostname under **Entra ID → Domain names** and publish its verification TXT record. 3. Verify the domain. 4. Open **Domain names → Custom URL domains**, select **Add custom url domain**, choose the verified domain and select **Add**. ![Entra custom domain names showing a verified domain](https://cdn.document360.io/db6f7316-640d-4099-b5a1-b01b4dbd17fc/Images/Documentation/entra-04-custom-domains.png?sv=2026-02-06&spr=https&st=2026-12-01T03%3A44%3A22Z&se=2026-12-01T04%3A44%3A22Z&sr=b&sp=r&sig=YCFQrSjOsFKQKkfiQeaezBIwyFCpkdiEBVjZ5abOsyk%3D) Domain verification and custom URL domain association are separate steps. Use [Microsoft's documented workflow](https://learn.microsoft.com/en-us/entra/external-id/customers/how-to-custom-url-domain) rather than relying on an undocumented `supportedServices` PATCH value. ### A.3 Add the AFD custom domain ```bash az afd custom-domain create -g $RG --profile-name $P \ --custom-domain-name 'entra-' \ --host-name 'entra.' \ --minimum-tls-version TLS12 --certificate-type ManagedCertificate # returns validationProperties.validationToken -> the _dnsauth TXT value az afd route update -g $RG --profile-name $P --endpoint-name dwn-entra \ --route-name default-route --custom-domains 'entra-' ``` Publish the `_dnsauth.entra.<customer-domain>` TXT record with the returned token. Wait for validation to complete before continuing. ![Front Door Domains blade showing Validation state Approved and certificate Deployed](https://cdn.document360.io/db6f7316-640d-4099-b5a1-b01b4dbd17fc/Images/Documentation/azure-05-custom-domain.png?sv=2026-02-06&spr=https&st=2026-12-01T03%3A44%3A22Z&se=2026-12-01T04%3A44%3A22Z&sr=b&sp=r&sig=u%2BGSvxNF324Uz8TI34CCY1wAyoPQYBsa8UnhHs4U3vQ%3D) Note the **DNS state** column showing a warning that the CNAME/alias record does not point at Front Door. **That is expected and correct in this architecture** — the hostname must CNAME to CloudFront, not to Front Door. See [§10 Certificate rotation](/docs/microsoft-entra-native#certificate-rotation-needs-a-diary-entry) for the operational consequence. Wait until the domain validation and certificate deployment have completed, then verify TLS for the public hostname. --- ## Part B — CloudFront and the Darwinium workers Follow the Darwinium **[CloudFront Deployment](https://docs.darwinium.com/docs/cloudfront-deployment)** guide for the parts that are not specific to this integration: - **Step 1** — note your External ID from the Darwinium portal - **Step 2** — note your AWS Account ID - **Steps 4–7** — the `getfunction` policy, the Lambda@Edge execution role, the Darwinium deployment policy and the deployment role - **Step 8** — enter the distribution ID and role ARNs back into the portal **Everything below is where this integration deliberately departs from that guide.** The differences are not optional. ### B.1 Distribution settings that differ | Setting | Darwinium's general guidance | **Use here** | Why | | --- | --- | --- | --- | | Cache policy | `CachingOptimized` | **`CachingDisabled`** | Keep authentication responses out of shared caches | | Origin request policy | `AllViewer` *or* `AllViewerExceptHostHeader` | **`AllViewer`** (required) | Darwinium must see the viewer's Host to match journey steps | | Origin domain | your application origin | **the AFD endpoint** `<afd-endpoint>.azurefd.net` | Front Door performs the Host rewrite | | Allowed methods | — | `GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE` | The native auth API is POST-based | | Viewer protocol policy | — | HTTPS only | | ![CloudFront distribution general settings showing the alternate domain name and custom SSL certificate](https://cdn.document360.io/db6f7316-640d-4099-b5a1-b01b4dbd17fc/Images/Documentation/aws-01-distribution-general.png?sv=2026-02-06&spr=https&st=2026-12-01T03%3A44%3A22Z&se=2026-12-01T04%3A44%3A22Z&sr=b&sp=r&sig=CEhH2d9FlyWWqY4IZF379gUrauIOlvJ31iz5mQ%2B4Npc%3D) The origin points at the Front Door endpoint: ![CloudFront origin configuration with the origin domain set to the Azure Front Door endpoint](https://cdn.document360.io/db6f7316-640d-4099-b5a1-b01b4dbd17fc/Images/Documentation/aws-02-origin.png?sv=2026-02-06&spr=https&st=2026-12-01T03%3A44%3A22Z&se=2026-12-01T04%3A44%3A22Z&sr=b&sp=r&sig=j%2BhMljNp0Z7lZXWMXAia%2FiM%2BZee%2BEwlNCYuDcMy85Ak%3D) ### B.2 Behaviours Create a behaviour per native-auth path, plus the matching `/dwn_redirect/...` paths that the Darwinium workers use for their internal loopback. All of them use `CachingDisabled` + `AllViewer`. ``` //oauth2/v2.0/initiate //oauth2/v2.0/challenge //oauth2/v2.0/introspect //oauth2/v2.0/token /dwn_redirect//oauth2/v2.0/initiate /dwn_redirect//oauth2/v2.0/challenge /dwn_redirect//oauth2/v2.0/introspect /dwn_redirect//oauth2/v2.0/token ``` ![CloudFront behaviours list: nine behaviours, all using Managed-CachingDisabled and Managed-AllViewer](https://cdn.document360.io/db6f7316-640d-4099-b5a1-b01b4dbd17fc/Images/Documentation/aws-03-behaviours.png?sv=2026-02-06&spr=https&st=2026-12-01T03%3A44%3A22Z&se=2026-12-01T04%3A44%3A22Z&sr=b&sp=r&sig=KXN6wVsQu8oLYrr23blX8DxYqrmiPhW14ZYbrgYYDNw%3D) A single behaviour, showing the policy pair and the Darwinium Lambda@Edge association on **origin request** with *Include body* enabled: ![Behaviour detail showing CachingDisabled, AllViewer, and the Lambda@Edge origin-request association](https://cdn.document360.io/db6f7316-640d-4099-b5a1-b01b4dbd17fc/Images/Documentation/aws-04-behaviour-detail.png?sv=2026-02-06&spr=https&st=2026-12-01T03%3A44%3A22Z&se=2026-12-01T04%3A44%3A22Z&sr=b&sp=r&sig=DACzfpRL5oG3wvNwxXisZ89tQpSZTHKAOL1x76rpcEI%3D) > **Both tenant path forms work at Entra** — `/<tenant-id>/…` and `/<tenant-name>.onmicrosoft.com/…`. A rule bound to only one form is **bypassable via the other**. Microsoft's own WAF route example uses only the GUID form. If you are relying on path-scoped behaviours or WAF rules as a control, cover both forms. ### B.3 Certificate and DNS Request the certificate in **us-east-1** — CloudFront will not accept one from any other region — and attach it as the distribution's custom SSL certificate with `entra.<customer-domain>` as an alternate domain name. ![ACM certificate in us-east-1, status Issued, associated with the CloudFront distribution](https://cdn.document360.io/db6f7316-640d-4099-b5a1-b01b4dbd17fc/Images/Documentation/aws-05-acm-certificate.png?sv=2026-02-06&spr=https&st=2026-12-01T03%3A44%3A22Z&se=2026-12-01T04%3A44%3A22Z&sr=b&sp=r&sig=p5vdBqVUySreQ%2F0B5ks9Gb0HSL5axHCjRMjrWT7T%2Bso%3D) Three DNS records are involved: | Name | Type | Value | Purpose | | --- | --- | --- | --- | | `entra.<customer-domain>` | CNAME | `<distribution-domain>.cloudfront.net` | Public entry point | | `_dnsauth.entra.<customer-domain>` | TXT | AFD validation token | Front Door custom domain | | `_<hash>.entra.<customer-domain>` | CNAME | ACM validation target | ACM certificate | ![Route 53 records showing the CloudFront CNAME, the ACM validation CNAME and the _dnsauth TXT record](https://cdn.document360.io/db6f7316-640d-4099-b5a1-b01b4dbd17fc/Images/Documentation/aws-06-route53.png?sv=2026-02-06&spr=https&st=2026-12-01T03%3A44%3A22Z&se=2026-12-01T04%3A44%3A22Z&sr=b&sp=r&sig=S6%2FPjA4aU4UJVMcDiY3iQ9Tug%2F6ARAaLJSCgbR7X%2BNQ%3D) > The Entra tenant-verification TXT (`MS=ms…`) must be **removed** once the domain is verified — a CNAME cannot coexist with a TXT record at the same name, and this hostname needs the CNAME. ### B.4 Build order Order matters. This sequence works: 1. Front Door profile, endpoint, origin group, origin with `--origin-host-header`, route 2. Domain added and verified on the tenant, and associated as a Custom URL domain 3. AFD custom domain, validated via `_dnsauth` TXT, associated with the route 4. **Go/no-go**: verify Front Door route, custom-domain and certificate deployment before adding CloudFront 5. ACM certificate, CloudFront alias, origin → AFD endpoint, all behaviours → `AllViewer` 6. `entra.<customer-domain>` CNAME → CloudFront 7. **Deploy the Darwinium journey last**, so its validator sees the final configuration > After changing the origin or host configuration, redeploy the Darwinium journey and test each authentication leg. Intermittent routing errors can indicate propagation or stale workers, but are not sufficient to identify the cause by themselves. --- ## Part C — Entra configuration for step-up Configure the authentication context, Conditional Access policy and usable second factor together. Requesting a context without an enforcing policy does not establish that MFA occurred. ### C.1 Review Security Defaults and Conditional Access If Security Defaults is enabled, plan the transition to Conditional Access before enabling the policy below. Review the replacement baseline and emergency access with your tenant administrator. The portal setting is under **Entra ID → Overview → Properties → Manage security defaults**. ![Entra tenant properties showing Security defaults](https://cdn.document360.io/db6f7316-640d-4099-b5a1-b01b4dbd17fc/Images/Documentation/entra-01-security-defaults.png?sv=2026-02-06&spr=https&st=2026-12-01T03%3A44%3A22Z&se=2026-12-01T04%3A44%3A22Z&sr=b&sp=r&sig=uFBxzZoz%2BKcqsLBTPzIbLvVdE7zx5BalW4s0Cs2mAd0%3D) Microsoft also documents a [Graph API for Security Defaults](https://learn.microsoft.com/en-us/graph/api/identitysecuritydefaultsenforcementpolicy-update?view=graph-rest-1.0). A denied request should be investigated as a permissions or tenant-context issue, not treated as proof that the API is unsupported. ### C.2 Create the authentication context The ID is chosen explicitly; there is no need to create `c1`/`c2` first. ```http PATCH https://graph.microsoft.com/v1.0/identity/conditionalAccess/authenticationContextClassReferences/c3 Content-Type: application/json {"id":"c3","displayName":"Darwinium step-up","isAvailable":true} ``` Visible in the portal at **Conditional Access → Authentication contexts**. ### C.3 Create the Conditional Access policy ```http POST https://graph.microsoft.com/v1.0/identity/conditionalAccess/policies Content-Type: application/json { "displayName": "Darwinium step-up - require MFA for auth context c3", "state": "enabled", "conditions": { "applications": { "includeAuthenticationContextClassReferences": ["c3"] }, "users": { "includeUsers": ["All"] } }, "grantControls": { "operator": "OR", "builtInControls": ["mfa"] } } ``` ![Conditional Access policies list showing the Darwinium step-up policy with State On](https://cdn.document360.io/db6f7316-640d-4099-b5a1-b01b4dbd17fc/Images/Documentation/entra-02-ca-policies.png?sv=2026-02-06&spr=https&st=2026-12-01T03%3A44%3A22Z&se=2026-12-01T04%3A44%3A22Z&sr=b&sp=r&sig=CIA0ndbzr6OENrdX8g50qPhVEBp6QG8HS5dsZottAbQ%3D) The policy example targets all users for context `c3`. Start with a controlled test group and review the intended scope before broadening it; do not assume that only one integration can request that context. #### Graph permissions Use the permissions documented for each Graph endpoint and the appropriate administrator role. The [Conditional Access policy API](https://learn.microsoft.com/en-us/graph/api/conditionalaccessroot-post-policies?view=graph-rest-1.0) supports delegated and application permissions; its documentation also notes a permissions issue that may require additional consent. A tenant-specific failure does not establish a general app-only limitation. Remove temporary setup permissions when finished. ### C.4 Enable the second factor This walkthrough uses **email OTP** with email-and-password sign-in. Enable the method for the intended users under **Authentication methods → Policies**. ![Authentication method policies with Email OTP enabled in the reference tenant](https://cdn.document360.io/db6f7316-640d-4099-b5a1-b01b4dbd17fc/Images/Documentation/entra-05-auth-methods.png?sv=2026-02-06&spr=https&st=2026-12-01T03%3A44%3A22Z&se=2026-12-01T04%3A44%3A22Z&sr=b&sp=r&sig=eLlO8aRMbrLpVXOyxHzJgmc%2B7G4xaWI3iLNStEwIwhQ%3D) Do not assume workforce methods such as Microsoft Authenticator or software OATH work in the native flow shown here. Microsoft documents email and SMS OTP for native out-of-band challenges; available methods and fallback behaviour depend on the authentication flow. See [native challenge types](https://learn.microsoft.com/en-us/entra/identity-platform/concept-native-authentication-challenge-types). ### C.5 Register and verify the user's method Use the External ID registration flow to ensure the test user has a usable strong authentication method. The native `/introspect` response identifies available methods. Confirm that the user can complete the email OTP challenge before testing Darwinium-triggered step-up. A recovery email field alone does not prove that the method is available for MFA. Follow [Microsoft's External ID MFA guidance](https://learn.microsoft.com/en-us/entra/external-id/customers/concept-multifactor-authentication-customers) for your tenant and flow. --- ## Part D — the Darwinium journey Configure a step for each native-auth endpoint you use. The abbreviated YAML below shows the `initiate` step, not a complete deployable journey. All steps bind to the **host alias** representing your public hostname, and the `token` step carries the decisioning. ```yaml api_version: darwinium.com/api/journey/v1 journey_name: entra-native-auth steps: - step_name: initiate proxy_event: url: //oauth2/v2.0/initiate host: entrahost method: POST url_match_type: Exact request: multipart_body_rules: - name: username extract_to_attribute: custom.general_purpose['username'] - name: capabilities extract_to_attribute: custom.general_purpose['capabilities'] response: body_rule: jsonpath: - name: $.continuation_token extract_to_attribute: primary_session_tie event_type: misc_other ``` Declare the alias in `journeys.yaml`: ```yaml journeys: - entra-native-auth.journey.yaml targets: - name: cloudfront type: cloudfront enabled: true valid_host_list: - entrahost ``` ### D.1 The step-up injection On the `token` step, the `claims` field is inserted into the form-encoded body when the score crosses your step-up threshold. The score name and threshold below are illustrative and must match your deployed model: ```yaml - name: claims inject: content: '{"access_token":{"acrs":{"essential":true,"value":"c3"}}}' mode: OverwriteOrInsertContent condition: outcome[CHAMPION].models.score["token.rba"] < -300 ``` > **`OverwriteOrInsertContent` is the only mode that creates a field that is absent.** The two `Overwrite*` modes act only *if the field already exists*, and `InsertIfNotPresent` is not a valid mode. Valid modes are `Overwrite`, `OverwriteContent`, `OverwriteOrInsertContent`, `Before`, `After`, `BeforeContent`, `AfterContent`. > > > Insertion into `application/x-www-form-urlencoded` bodies **does** work. > > > **Do not add a resource scope to the step-up request.** Sending `scope=… api://<client-id>/App.Read` returns `AADSTS500011: The resource principal … was not found in the tenant` unless the app has an Application ID URI. The `claims` parameter alone is correct. ### D.2 The reject outcome Configure the proxy action to terminate the rejected request and return an error without tokens or a continuation token. Omitting a field alone is not an enforcement rule. The fragment below illustrates only the response body; add the matching reject condition, response status and termination action in your journey. ```yaml proxy_action: name: proxy dependencies: [token.rba] execute_code: proxy.rules response_body: template: >- { "error": "invalid_grant", "error_description": "AADSTS50126: Error validating credentials due to invalid username or password.", "error_codes": [50126], "timestamp": "{{ timestamp }}", "suberror": "invalid_password" } ``` ### D.3 Preserve plus signs in usernames In a form-encoded request, a literal `+` decodes to a space. Encode a plus sign as `%2B`; for example, use `--data-urlencode 'username=user+tag@example.com'` with cURL. Keep the identity value and decision condition as `user+tag@example.com`. Do not compensate for an encoding error by treating a space-containing username as the same account. --- ## 8. The client-side flow Your application drives six legs. Legs 4–6 only occur when Darwinium triggers a step-up. ![Sequence diagram of the six-leg native auth step-up flow through Darwinium](https://cdn.document360.io/db6f7316-640d-4099-b5a1-b01b4dbd17fc/Images/Documentation/diagram-02-stepup-sequence.png?sv=2026-02-06&spr=https&st=2026-12-01T03%3A44%3A22Z&se=2026-12-01T04%3A44%3A22Z&sr=b&sp=r&sig=Znta0teial0ppsSvpNkSZ5zFBOpLBk6Jw4HwHVJ6DCE%3D) > **This trace shows an out-of-band (OOB) second factor — email OTP.** The `/introspect` → `/challenge` → `grant_type=mfa_oob` legs are the OOB pattern, shared by email and SMS. If you use a different method the challenge legs differ; what does **not** change is legs 1–3, the `claims` injection, or the requirement to re-send `claims` on the final `/token`. ### Wire-format traps Handle the response type and error details at each stage. | Trap | Symptom | Fix | | --- | --- | --- | | `capabilities` is **space-separated** | `AADSTS901020: unsupported capability` | `capabilities=mfa_required registration_required` — not comma-separated | | `grant_type` must be **`mfa_oob`**, not `oob` | `AADSTS55200: The continuation_token is invalid` — the token is fine | Use `mfa_oob` on the final leg. Do not chase token expiry when you see 55200 | | `registration_required` capability omitted | **HTTP 200** with `{"challenge_type":"redirect", …}` — no token, no error | Always send it when the user may have no method registered | | `claims` not re-sent on the final `/token` | Step-up completes but `acrs` lacks `c3` | The auth context must be requested on the call that *completes* the flow, not only the one that triggers it | | Continuation token rejected or expired | `AADSTS55200` | Check the grant type and flow state; restart authentication when the continuation token is no longer valid | | `+` in a form body decodes to a space | Plus-addressed logins fail with `user_not_found` | Use `--data-urlencode` | ### If you build against a mock first A mock will pass while live Entra fails, unless you handle these differences: | | Mock | **Live Entra** | | --- | --- | --- | | Step-up suberror | `credential_required` / `50076` | **`mfa_required` / `50074`** | | Email OTP length | 6 | **8** | | Final `acrs` | `['c3']` | `['c3','p1','urn:user:registersecurityinfo','pfdr']` | Anything hard-coding an OTP length, matching on `50076`, or testing `acrs == ['c3']` rather than `'c3' in acrs` will pass on a mock and fail live. Read `code_length` from the `/challenge` response rather than assuming it. --- ## 9. Verification **A green flow proves nothing on its own.** Under `AllViewerExceptHostHeader` the API returns 200 *precisely because* Darwinium is doing nothing. You must check two independent conditions. ### Verify policy enforcement Check the requested `c3` context in the returned token where applicable, and confirm the Conditional Access and MFA result in Entra sign-in logs. A context claim alone is not proof that a fresh MFA challenge occurred; an existing authentication session may already satisfy the policy. Test a known allow, a forced step-up and a forced reject. Confirm that reject returns no usable tokens and that step-up cannot complete without satisfying the configured policy. Inspect tokens locally and retain normal signature, issuer, audience and expiry validation in the application. ### Confirm Darwinium saw the request In the Lambda@Edge logs, look for `matched steps` on `initiate`, `challenge` and `token`, with **zero** `no steps match`. ```bash # The PoP moves, so scan regions and match the [N] in the log stream # name to the deployed worker version. for R in us-east-1 us-east-2 us-west-2 ap-southeast-2 eu-west-1; do aws logs describe-log-streams --region $R \ --log-group-name /aws/lambda/us-east-1.dwn_e10x_cloudfront_orequest__token \ --order-by LastEventTime --descending --max-items 1 \ --query 'logStreams[0].logStreamName' --output text 2>/dev/null done ``` > **Scope the log window to *after* the journey redeploy.** A wider window mixes in pre-deploy `no steps match` entries and makes a clean result look broken. > > > **Lambda@Edge logs go to the PoP's region, and the PoP moves.** Looking in the wrong region produces a confident, wrong "the workers aren't running" conclusion. Always scan, and always check the `[N]` version in the stream name matches what is deployed. ### Test the context request directly Send `claims` by hand. This works both direct to Entra and through the full proxy chain: ```bash curl -X POST "https://entra.//oauth2/v2.0/token" \ --data-urlencode "username=" \ --data-urlencode "password=" \ -d "client_id=&continuation_token=&grant_type=password&scope=openid offline_access" \ --data-urlencode 'claims={"access_token":{"acrs":{"essential":true,"value":"c3"}}}' ``` Use the response and Entra sign-in logs to confirm that the intended context and policy were applied; do not treat HTTP 200 alone as proof of enforcement. --- ## 10. Operating this in production ### Certificate rotation needs a diary entry Because `entra.<customer-domain>` must CNAME to **CloudFront** so the Darwinium workers see the traffic, it does not CNAME to Front Door. Per the Azure Front Door documentation, AFD **does not auto-rotate** a managed certificate when the custom domain's CNAME points anywhere other than the AFD endpoint. Roughly **45 days before expiry** the domain enters *Pending Revalidation* and someone must publish a fresh `_dnsauth` TXT record by hand. If nobody does, the certificate lapses and **TLS breaks silently**. Two options: - **Accept and diarise** — fine for a demo or pilot, provided it is written down. - **Bring your own certificate via Key Vault** — no revalidation cycle. The key vault must be in the *same subscription as the AFD profile*. Switching from managed to BYOC does not require revalidation. ### Caching stays off at both layers Keep authentication routes uncached and prevent user-specific token or challenge responses from being reused by shared caches. ### Path-form ambiguity is a real control gap Both `/<tenant-id>/…` and `/<tenant-name>.onmicrosoft.com/…` are served by Entra. Any control — WAF rule, CloudFront behaviour, journey step — bound to one form is bypassable via the other. Cover both. ### Check for paths that bypass the protected hostname Test the default `ciamlogin.com` domain, tenant-ID and tenant-name paths, and any directly reachable Front Door endpoint. A custom hostname does not automatically disable other entry points. Microsoft documents requesting default-domain blocking through support; review its feature limitations before rollout. See [blocking the default domain](https://learn.microsoft.com/en-us/entra/external-id/customers/how-to-custom-url-domain#optional-block-the-default-domain). ### Cost Front Door and CloudFront incur service charges. Remove only dedicated test resources after confirming that no shared deployment depends on them. --- ## 11. Troubleshooting | Symptom | Likely cause | Action | | --- | --- | --- | | `AADSTS399265` on **every** leg | Custom URL domain not registered, or Front Door ID not trusted by the tenant | Complete [A.2](/docs/microsoft-entra-native#a-2-register-the-domain-on-the-entra-tenant); allow for propagation | | `AADSTS399265` on a **different leg each run** | Propagation or stale workers after an origin change | Check route status and worker versions; redeploy the journey after configuration is final | | `AADSTS399280 InvalidCustomUrlDomain` | Domain verified but not associated as a Custom URL domain | Associate the verified domain in **Domain names → Custom URL domains** | | 404 on every path, `x-cache: CONFIG_NOCACHE` | Front Door route has not propagated | Check deployment status and allow for propagation before changing the route again | | 502 from CloudFront | Origin request policy is `AllViewer` but the origin is Entra directly, not Front Door | Point the origin at the AFD endpoint | | 200 responses but `no steps match` in logs | Origin request policy is `AllViewerExceptHostHeader` | Switch to `AllViewer` | | `BadRequest: Security Defaults is enabled` | Security Defaults still on | [C.1](/docs/microsoft-entra-native#c-1-review-security-defaults-and-conditional-access) | | Step-up "works" but no MFA prompt | Missing/mis-scoped policy, or an existing MFA session already satisfies it | [C.3](/docs/microsoft-entra-native#c-3-create-the-conditional-access-policy); verify the Conditional Access and MFA result in Entra sign-in logs | | HTTP 200 with `{"challenge_type":"redirect"}` | `registration_required` capability missing and user has no method | Handle the redirect fallback or implement the required registration capability | | `AADSTS901020: unsupported capability` | `capabilities` sent comma-separated | Use spaces and advertise only capabilities your client implements | | `AADSTS55200: continuation_token is invalid` on the final leg | `grant_type=oob` instead of `mfa_oob`, or token expired | Check the grant type **first** | | `AADSTS500011: resource principal not found` | A resource scope was added to the step-up request | Send `claims` alone | | Injection never fires for a plus-addressed user | `+` decoded to a space | Correct the client encoding with `--data-urlencode` | | TLS failure shortly after adding the custom domain | Managed certificate still deploying | Wait | | TLS failure months later | Managed certificate lapsed — no auto-rotation | [§10](/docs/microsoft-entra-native#certificate-rotation-needs-a-diary-entry) | --- ## 12. Appendix: parameters Replace throughout: | Placeholder | Meaning | Example shape | | --- | --- | --- | | `entra.<customer-domain>` | Public hostname you expose | `entra.example.com` | | `<tenant-name>` | External ID tenant name | `contosociam` | | `<tenant-id>` | External ID tenant GUID | `00000000-0000-0000-0000-000000000000` | | `<client-id>` | Native auth public client application ID | GUID | | `<afd-endpoint>` | Front Door endpoint hostname | `dwn-entra-xxxx.z01.azurefd.net` | | `<front-door-id>` | Front Door profile ID, registered on the tenant | GUID | | `<distribution-id>` / `<distribution-domain>` | CloudFront distribution | `E…` / `d….cloudfront.net` | | `<aws-account-id>` | AWS account hosting the distribution | 12 digits | | `<hosted-zone-id>` | Route 53 zone for the domain | `Z…` | | `<target>` | Darwinium edge target name | `entraweb` | ### Reference - [Darwinium — CloudFront Deployment](https://docs.darwinium.com/docs/cloudfront-deployment) - [Darwinium — Journey lifecycle management](https://docs.darwinium.com/docs/journey-lifecycle-management) - [Microsoft — Third-party account takeover protection with native authentication](https://learn.microsoft.com/en-us/entra/external-id/customers/tutorial-third-party-account-take-over-protection-native-api) - [Microsoft — Azure Front Door certificate rotation](https://learn.microsoft.com/en-us/azure/frontdoor/domain#certificate-renewal) --- *Screenshots in this guide are from a reference deployment. Account identifiers, tenant IDs and subscription IDs have been replaced with placeholders.*