Course contents · Boundary and identity policy
- 1. Map one application before adding Cloudflare AccessFree
- 2. Build and test a Cloudflare Access identity policyFree
- 3. Connect a scoped Cloudflare Tunnel to the portalFree account
- 4. Validate the Cloudflare Access origin boundaryPremium
- 5. Test Access session expiry and revoke a departing reviewerPremium
- 6. Diagnose Access decisions, tunnel faults and origin failuresPremium
- 7. Handover a protected portal with acceptance and recovery evidencePremium
Build and test a Cloudflare Access identity policy
Use the real policy builder to separate Include, Require and Exclude conditions. Review policy actions, shared-policy effects and the limits of the built-in policy tester before attaching a policy to the portal.
24 MIN
By AISecurityInterviews · Updated
TL;DR: Write the intended identity decision as a truth table, then configure the same logic in Access. An Include condition expands eligibility; Require and Exclude narrow it. Other policies and existing sessions still need their own review.
Where you are. Second lesson. The portal boundary is defined. You will prepare a dedicated policy and Access application before any tunnel route exposes the origin.
Reference and lab scope. Cloudflare One documentation, checked November 2026. Public-hostname self-hosted browser application, existing corporate IdP and no device-client authentication. Product steps are documentation-checked; the Python exercise is an executed offline logic model, not a Cloudflare policy engine. Use product changes only in an explicitly authorized test account.
Read the actual builder

Official Cloudflare documentation screenshot, published with the April 2026 application-builder update. © Cloudflare and contributors, CC BY 4.0, unmodified. Open the full-size image. This is the OEM's screen, not a result from our lab.
Locate three controls before reading the example: Action, the Include / Require / Exclude buttons and Policy session duration. The labels identify different decisions. An Allow action says what happens when the conditions match. It does not mean every condition on the page is joined with OR.
Cloudflare's policy reference defines Include as an OR across eligible conditions, Require as an AND across required conditions, and Exclude as a disqualifier. All policies need an Include condition. Do not add Everyone to an Include list simply to make the builder accept a policy; that changes the eligible population.
Translate North Quay's decision
The customer approves Mira and Dev. Rowan appears in an inherited reviewer list but has left the project. All three names are retained in this fictional candidate so the exclusion is exercised. The policy is deliberately small enough to audit.
| Builder field | Lab value | Reason |
|---|---|---|
| Policy name | LAB-NQ-REVIEWERS | Dedicated policy for this change |
| Action | Allow | Admit only a matching identity |
| Include: Emails | [email protected], [email protected], [email protected] | Explicit candidate population |
| Require: Login Methods | The customer's approved corporate IdP | A matching email from another login method is insufficient |
| Exclude: Emails | [email protected] | Remove the former reviewer from this candidate |
| Policy session duration | 15 minutes for this isolated rehearsal | Make session behavior part of the test record |
Select the actual registered IdP in the lab account. The corporate IdP must already be configured and tested, including its approved MFA enforcement. Login Methods identifies the login provider; it does not itself prove that MFA occurred. If the customer wants an Access authentication-method requirement, verify the IdP's supported claim mapping against Cloudflare's MFA requirements before adding it. Do not infer the claim from a successful sign-in screen.
The 15-minute duration is a lab decision, not a universal production recommendation. Session renewal and IdP reauthentication are different events; the fifth lesson examines them. In a production review, replace the inherited list with its approved source of truth and document how joiners and leavers are synchronized.
Check the logic offline
This example evaluates one Allow policy using synthetic, already-established identity attributes. It does not authenticate a person, verify an IdP assertion, evaluate every Access selector or terminate existing sessions. A successful result is a check of the proposed logic only.
included = {"[email protected]", "[email protected]",
"[email protected]"}
excluded = {"[email protected]"}
approved_method = "north-quay-corporate-idp"
def permits(identity):
return (identity.get("email") in included
and identity.get("login_method") == approved_method
and identity.get("email") not in excluded)
cases = [
({"email": "[email protected]", "login_method": approved_method}, True),
({"email": "[email protected]", "login_method": approved_method}, True),
({"email": "[email protected]", "login_method": approved_method}, False),
({"email": "[email protected]", "login_method": approved_method}, False),
({"email": "[email protected]", "login_method": "different-idp"}, False),
({"email": "[email protected]"}, False),
]
results = [permits(identity) for identity, _ in cases]
print(results) # => [True, True, False, False, False, False]
assert all(permits(identity) == expected for identity, expected in cases)
# A review mistake: moving the login-method check into Include expands access.
def mistaken_or(identity):
return ((identity.get("email") in included
or identity.get("login_method") == approved_method)
and identity.get("email") not in excluded)
unknown = cases[3][0]
print(mistaken_or(unknown)) # => True
assert not permits(unknown)
The last output is a failed design, not an instruction to deploy it. The unknown user qualifies under the mistaken OR because they used the corporate IdP. The intended AND requires both an eligible email and the approved provider. In a review, demand a negative case that distinguishes the two expressions.
Create a dedicated policy and application
Follow the current policy management workflow. In Zero Trust > Access controls > Policies, choose Add a policy and enter the reviewed fields. Confirm that the name is not an existing shared policy. Before editing any reusable policy, inspect every application that references it: a saved edit affects all associated applications.
Use the Policy tester to inspect the intended users where available. The tester relies on identities that previously logged in to Access or the App Launcher, and uses the most recently authenticated device. A missing user is not a demonstrated denial. A successful policy preview is not a live origin, session or application-role test. Record the population and context the preview actually covers.
Next, follow the self-hosted application procedure:
- Open Zero Trust > Access controls > Applications and choose Create new application.
- Select Self-hosted and private, then Add public hostname.
- Enter the authorized lab equivalent of
review.northquay.example; leave Path empty for the whole hostname. Check for more specific existing applications. - Attach the dedicated
LAB-NQ-REVIEWERSpolicy. Review every attached policy, not just the one you created. - Restrict accepted identity providers to the approved corporate IdP. Do not select all available providers by default. Confirm the baseline does not enable authentication using a Cloudflare One Client session.
- Review the application's session setting and any policy override. Save only after the owner approves the final destination and policy list.
The tunnel route remains unpublished at this stage. Record the account, application ID, policy ID, configured destination, accepted IdP and policy order. The application audience used for origin validation will be collected in the fourth lesson.
Review actions and order across the whole application
An exclusion narrows one policy. It is not an account-wide prohibition that automatically defeats every other policy. For example, a different Allow policy might still admit Rowan. Treat the application-level result as the combination of the relevant policies and their evaluation order.
Cloudflare's order of execution places Bypass and Service Auth policies ahead of the Allow/Block group; each group follows its configured order. Once an Allow or Block match decides the request, later rules cannot override it. Do not assume that the visually first Allow rule defeats a Bypass elsewhere in the list.
This baseline has one dedicated Allow policy and no Bypass or Service Auth policy. Unmatched users remain denied. Cloudflare documents that Bypass disables Access enforcement and its request logging. It is unsuitable as a troubleshooting switch for this private portal. A future automation requirement needs a separately reviewed machine identity and policy.
Intended policy
Listed identity
Include
Corporate IdP
Require
Not excluded
Exclude checked
Outcome, safe: All conditions hold
Mistaken expanded Include
Unknown identity
Not listed
Corporate IdP
Satisfies the OR
Outcome, unsafe: Too many identities qualify
Do this before moving on
Run the six offline cases. Add an excluded user with the wrong login method and an empty identity record. Prepare the candidate builder values, full attached-policy list and policy-tester observations. Explain which cases the tester could not evaluate and which remain for live rehearsal.
Review criteria: Mira and Dev qualify, Rowan and unknown identities do not, the approved email alone is insufficient, and no shared-policy edit can silently change another application. A policy preview without the negative cases or population limits does not close the review.
Go deeper
- Access-control models explains how eligibility and contextual requirements combine.
- OpenID Connect separates the provider's assertion from the application's decision.
- Zero trust in practice tests whether a named security model becomes an enforceable boundary.
- Sessions, cookies and tokens prepares the later session and revocation tests.
Key takeaways
- Treat Include as eligibility and Require as an additional condition.
- Check exclusions against every relevant policy, not only the candidate.
- Review all consumers before changing a reusable policy.
- Policy-tester results depend on stored identities and device context.
- Restrict the application destination and login methods before publishing a route.
Check yourself
Say or write your answer first, then reveal. Explaining it from memory, in your own words, is the skill an interviewer is checking.
1Why can putting the approved IdP in Include admit an unlisted user?
2Rowan is excluded from one Allow policy. Can the reviewer declare Rowan blocked everywhere?
3The policy tester has never seen Dev. Is the missing result proof of denial?
Sign in to track which lessons you have finished.