Skip to content
Tech Interview Prep
Technical interview guide

Identity Lifecycle & Provisioning

Automating account creation, access changes, and deprovisioning across a person's entire time at an organization.

Minutes to read
3
Practice MCQs
25
Interview Q&A
25
Edition
v6
Editorial status
Reviewed

Scope: SCIM RFC 7643/7644, NIST SP 800-53 Rev. 5 and SP 800-63C-4, current CISA, Microsoft Entra, Google Cloud, AWS IAM Identity Center, Okta, OWASP, and OpenID guidance reviewed 2026-09-04.

Interview Q&A

Treat each question like a live interview question: answer out loud first (structure, assumptions, tradeoffs), then open the model answer to spot gaps and rehearse a tighter follow-up.

Curated: · Written: · Reviewed:

25 questions

Q&A-1

Design identity correlation across authoritative and target systems.

Answer

Assumptions I'd state up front: one authoritative HR system (Workday) owns employment state; targets are Entra ID, a set of SaaS apps synced over SCIM 2.0 (RFC 7643/7644), and one legacy LDAP app; ~40,000 employees; targets are eventually consistent and can lag the source by hours.

Core answer. Correlation is a mapping problem, not a matching problem. Mint one internal identity ID per person (a UUID you generate, never derived from any attribute) and keep one mapping row per (identity, target system, target resource ID). The authoritative system supplies the anchor (Workday Worker ID). Each target supplies its own immutable handle: Entra ID objectId, SCIM id, LDAP entryUUID. Email, username and display name are attributes with a lifecycle; they get reused, so they never key anything.

A mapping row carries: identity_id, target_system, target_resource_id, source_system, source_record_id, link_method (auto_exact / auto_fuzzy / human), confidence, status (active / pending / disabled / orphaned), valid_from, valid_to, last_reconciled_at. valid_to is what makes rehire and split representable instead of destructive.

Matching is a cascade, not one comparison.

TierSignalAction
1Stored mapping exists for this identity + targetUpdate in place
2Exact match on authoritative ID carried as SCIM externalId or SAML persistent NameIDAuto-link
3Exact match on employee number + date of birthAuto-link, flag for audit
4Fuzzy: normalized name + DOB + manager, score ≥ 0.95Auto-link
5Score 0.80–0.95Human review queue
6Score < 0.80Create a new identity

Those thresholds are illustrative; tune them against a labelled set of your own past merges.

Why correlation drifts. Renames change the attributes you were tempted to key on. Rehires produce a new authoritative record for the same human. Mergers and acquisitions bring a second HR source with its own numbering. Delayed target creation means the target record does not exist yet when the source event arrives, so the link is written later, or never. Each of these is a provenance change, and the mapping row is where you record it rather than overwrite it.

Trade-offs. Deterministic matching (tiers 2–3) is cheap, auditable and explainable; it fails on records with no shared authoritative ID, which is exactly the M&A and contractor case. Fuzzy matching covers those but produces false merges, and a false merge is worse than a duplicate: it hands one person another's group memberships and file access. So fuzzy auto-link only above a high threshold, human review in the band, and never fuzzy-match across tenants: a cross-tenant identifier collision should be a hard stop, not a score. Auto-merge is right for tier 2; human-in-the-loop is right for tier 5 and for every split.

Failure modes and detection. Reused address: a new hire inherits a leaver's mailbox. Detect by asserting the target account's createdDateTime is after the leaver's valid_to. Duplicate employee numbers across two HR sources: detect by a uniqueness constraint on (source_system, source_record_id) plus a periodic duplicate scan. Delayed target creation: detect by a reconciliation job that alerts when any active identity has no mapping row for a target after 24 hours. Cross-tenant identifiers: detect by scoping every query by tenant and failing closed on a missing tenant claim.

Arithmetic. 40,000 employees at 8% turnover is 3,200 leavers a year. If 1% of their addresses are reissued within 12 months, an email-keyed design silently merges ~32 new hires a year into departed employees' accounts. That is the number that pays for the mapping table.

Trace: rehire. Ana leaves 2024-03: identity 7f3a…, Entra objectId A1, Worker ID 10042, mapping row closed with valid_to. In 2025-01 Workday creates Worker ID 20877 for her, new address ana.rossi2@corp. Tier 1: no mapping for 20877. Tier 2: no externalId. Tier 3: employee number differs. Result: new identity, new target account; the old identity stays disabled with its history intact. An email-keyed design would have matched nothing here and been fine, but had the address been reissued to a different person, it would have merged them into Ana's account. The mapping table makes both cases the same code path.

Run a nightly full reconciliation plus event-driven deltas, and alert if any target has not reconciled in 24 hours.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-9

Map SCIM identifiers and usernames correctly.

Answer

Core answer (first 90 seconds)

Three fields, three different owners, and the bug is almost always conflating them.

fieldissued bymutabilityuniquenessjoin key?
idservice providerimmutableunique within the service provideryes, but only inside a tenant
externalIdprovisioning clientreadWriteschema declares noneyes: always scoped by tenant
userNameclient sets, SP enforcesreadWriteserver: unique across the SP's entire set of Usersno

id is server-issued and immutable (RFC 7643 §3.1). externalId is "the ID of the resource as defined by the provisioning client", and the RFC says the service provider MUST interpret it as scoped to the provisioning domain: its schema uniqueness is none, so you never assume it is globally unique. userName is required, uniqueness: server, caseExact: false, and MUST be unique across the service provider's entire set of Users.

So: correlate on (tenant, externalId), authenticate on userName, and never use userName as the join key.

Why matching on userName/email breaks

Worked trace: a customer renames their login email:

  1. IdP has id=8f3c…, externalId=emp-4471, userName=alice@acme.com. Your row is keyed (tenant=acme, externalId=emp-4471).
  2. Alice's email changes to alice@acme.io. The IdP sends PATCH /Users/8f3c… with {"op":"replace","path":"userName","value":"alice@acme.io"}. Same id, same externalId → you update the row. Correct.
  3. If the IdP is configured to POST instead, or you keyed on userName, you get POST /Users with userName=alice@acme.io and no matching externalId in your store → you create a second user. Two rows, one human.

The duplicate surfaces only on the next sync, when the POST collides on userName uniqueness and the server returns 409 with scimType: uniqueness (RFC 7644 §3.3). Detection signal: that 409, or user count drifting above HR headcount. Rename silently became create.

caseExact and normalization

caseExact: false on userName means SCIM filters compare case-insensitively: filter=userName eq "Alice@Acme.com" matches alice@acme.com (RFC 7644 §3.4.2.2). Your store must match that, or you create Alice@acme.com beside alice@acme.com, pass your own uniqueness check, and violate the RFC's. Normalize to a canonical comparison key (Unicode NFC, trim, lowercase) but store the original for display. Don't over-normalize: Gmail-style dot-stripping is not SCIM's job and will merge two distinct people.

Trade-offs

Immutable (tenant, externalId) mapping is the right default, but it fails on import: pre-existing accounts have no externalId. Two options. Match-on-provision by a verified attribute (the IdP's verified email claim), then write the externalId back: cheap, but a wrong match merges two humans irreversibly. Or fuzzy match into a human review queue: slower, but the blast radius is a ticket, not a merged account. Take match-on-provision only when the attribute is verified by the IdP; otherwise queue. Rehire is the same shape: same human, new externalId. Decide whether to reactivate the old id (keeps history, risks stale grants) or create new (clean, loses history): state the choice, don't let it default.

Protecting the mapping

Use meta.version as an ETag with If-Match on PATCH/PUT (RFC 7644 §3.14) so a stale client can't clobber a rename. Return 404, not 403, for cross-tenant id lookups so you don't leak existence. Log every mapping change with old/new externalId and the actor.

What would change this

If the IdP can't guarantee a stable externalId across renames, the scheme collapses: you're back to verified-attribute matching with review, and you should say so up front.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-16

Resolve multi-source identity data conflicts.

Answer

Clarify first. Two things decide this: which attributes are privilege-bearing, and which system is the operational system of record for each. If the interviewer means two sources disagree on department, that is descriptive and precedence settles it. If they mean the contractor portal still says this person is active while HR says terminated, that is privilege-bearing and the answer changes shape.

Core answer. Resolve per attribute, not per identity. Build an authority matrix naming, for each attribute, the ordered source list, the conflict policy, and the owner accountable when it fires. Make resolution deterministic and idempotent: same inputs, same output, every run. For privilege-bearing attributes, never union: take the intersection of what sources grant, or hold the current narrower state. Retain every losing value with its source and timestamp so the decision is auditable.

Mechanism. Normalize each source into one canonical schema (SCIM 2.0 User/Group, RFC 7643/7644) so active, department and groups mean the same thing across Workday, Okta and a partner IdP. Then apply precedence: lower rank wins, ties broken by effective date, then by ingestion time. Write with optimistic concurrency, SCIM meta.version plus If-Match, so a late-arriving push cannot clobber a newer decision.

attributeauthoritative orderconflict policyowner
active (employment)Workday → Okta → partner IdPHR wins; never fail openHRIS
department, managerWorkdayHR winsHRIS
displayName, emailOkta → WorkdayIdP winsIAM
entitlements / groupsnone: intersectleast privilege; deny on conflictApp owner
credentials, MFAOktaIdP winsIAM

Worked trace. Identity u-4821, a contractor.

  • 02:00 UTC: Workday batch sets employeeStatus=Terminated, active=false; SCIM PATCH to Okta.
  • 02:00:30: partner IdP pushes active=true and group contractor-portal-admin.
  • Resolver: active precedence is Workday first, so false is retained. The group is privilege-bearing, so it is intersected with the HR-derived entitlement set, empty, and no grant is made.
  • Conflict record written: both values, both sources, both timestamps, decision workday_wins.
  • 03:00: partner retries, same result. Churn counter for u-4821 is 2 suppressed writes; the alert threshold is 5 per identity per 10 minutes, so nobody is paged.

Trade-offs. Precedence is auditable and stable but needs governance whenever a source is added. Last-writer-wins is simpler and is what LDAP multi-master replication does with entryCSN, but it oscillates under clock skew and flapping. Union of entitlements never breaks access and always over-grants. Intersection is safe and under-grants during a source outage: that is the cost you accept for privilege-bearing attributes. Manual override is necessary for edge cases but must carry a TTL, or it becomes an undocumented second authority.

Failure modes. Flapping: two sources reasserting; detect by write-churn per identity, fix with precedence plus a suppression window. Stale HR replay: compare effective dates, not arrival order. Source outage: hold last-known-good, never fail open on active. Partner escalation: intersection catches it. Clock skew: trust ingestion time over source timestamps.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-2

Design a secure joiner workflow.

Answer

Core answer (first 90 seconds)

Assume Workday is the authoritative HR source, Entra ID (or Okta) is the IdP, and downstream apps speak SCIM 2.0. The workflow is four stages plus one that never stops: ingest, compute, provision, activate, reconcile.

  1. Ingest the worker record on the effective date, keyed on a stable immutable ID, Workday Worker ID, never email or name. Emails and names change; the Worker ID doesn't.
  2. Compute birthright entitlements as a deterministic function of role + department + location + worker type (employee vs contractor). Not a copy of a nearby colleague's access.
  3. Provision idempotently: SCIM POST with externalId = Worker ID. If the account already exists, SCIM returns 409 Conflict and you PUT instead. Create the account disabled.
  4. Activate at the effective time; gate sensitive entitlements behind approvals.
  5. Reconcile nightly: diff computed target state against queried actual state per app, and remediate.

Trade-offs

Push vs pull. Event-driven SCIM from HR gives minutes of latency but couples you to HR webhooks that can drop events. A scheduled pull every 15 minutes is simpler and self-healing but adds up to 15 minutes of latency. Most shops run both: push for speed, nightly pull as backstop.

Broad birthright vs least privilege. Broad birthright (everyone in Engineering gets the GitHub org and an AWS dev role) cuts tickets but over-provisions. Narrow birthright routes everything through access requests, adding manager-approval latency of hours to days. The deciding criterion: low-blast-radius and role-universal → birthright; touches production data or money → gate it.

Pre-provision vs just-in-time. Pre-provisioning at T-1 gives day-one readiness but creates accounts for no-shows. JIT activation at first login avoids that but delays the first hour.

Failure modes

  • Orphaned accounts. HR termination not propagated because the worker sat in a separate contractor system. Detect by reconciling HR active headcount against IdP active accounts; alert on accounts with no HR record older than 24h.
  • Duplicate accounts. Email change spawns a second account because the app keys on email. Detect via SCIM externalId collisions; fix by keying on Worker ID.
  • Over-provisioning. Birthright rule too broad (all of Engineering gets prod). Detect in quarterly access review; expect it to find roughly 20% excess.
  • Drift. App doesn't support SCIM, so manual grants accumulate. Detect by nightly diff; the cost is a human remediation queue.

Worked trace

Joiner: Worker ID 48213, role SDE, dept Payments, location US, start 2025-03-03.

Tactionsystemresult
T-1HR record createdWorkdayWorker ID 48213, status active-pending
T-1compute birthrightpolicy engineGitHub org member, AWS dev role, Slack, email
T-1SCIM POSTEntra ID → appsaccount created, disabled, externalId=48213
T-1gateaccess requestprod DB role → manager approval required
TenableIdPaccount active, birthright live
T+1reconcilenightly jobdiff target vs actual, 0 drift

Arithmetic: at 200 joiners/quarter and a 3% no-show rate, pre-provisioning creates ~6 orphaned accounts/quarter. Cheap to disable if reconciliation runs; expensive if it doesn't.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-3

Implement pre-hire and delayed activation safely.

Answer

What I'd say first

Assume Workday is the authoritative source for hire date and worker status, Okta is the IdP, and AD plus SaaS apps are downstream via SCIM 2.0 (RFC 7644). "Safe" means two invariants: no credential is usable before the effective instant, and no account becomes usable after the relationship is withdrawn. Those pull against each other, so I separate account creation from activation.

Stage

Create the account in a state that cannot authenticate. In Okta that's the STAGED lifecycle state: the user exists with a stable id and profile, has no password and no enrolled factors, and cannot sign in. In AD, create the user with userAccountControl = 514 (0x0202, ACCOUNTDISABLE) and no password set; 512 is the enabled value. Push the same downstream via SCIM with active=false.

The trap is group rules. Okta group rules evaluate on profile attributes, and a pre-hire already has department and manager, so a rule like "department = Sales → Salesforce" fires at stage time and grants real entitlements. Either gate the rule on a custom attribute (employeeStatus = prehire) or assign groups only in the activation step. I'd do the latter: one code path grants, one revokes.

Gate

Activation is a separate idempotent job, not a side effect of creation. It runs on a schedule, and for each candidate it re-reads the source record at that moment and checks three things: worker status is still Active, the effective instant has passed, and the account is still STAGED. Only then does it flip active=true, set the initial credential, and assign groups.

Store the effective instant as UTC, computed from the source's local hire date plus the tenant timezone: Workday effective-dates the hire at 00:00 tenant time. Never store a naive local datetime.

Failure modes and how I'd catch them

  • Stale date. HR pushes the hire date out after staging; the job fires on the old date. Detect: log the source record's version/hash at stage time and compare at activation; alert on mismatch and skip.
  • Rescinded offer. Offer withdrawn after staging. The status re-read catches it; alert if the job ever sees status != Active for a staged account.
  • DST. A naive local time on 2026-03-08 in America/New_York lands in the 02:00–03:00 gap. Unit-test both 2026-03-08 and 2026-11-01.
  • Rehire collision. Same email as a deprovisioned account. SCIM returns 409 on a userName uniqueness conflict; decide explicitly whether to reactivate the old account or mint a new one. If you reactivate, revoke existing sessions and OAuth refresh tokens first: an old refresh token survives deprovisioning and is the real hole.
  • Orphan. Staged account never activated and never deleted. Weekly report of accounts in STAGED longer than 30 days.

Trade-off

Staging versus just-in-time provisioning. JIT creates the account at first SAML login, so there are no orphans and no cancellation race, but no mailbox, no calendar, no laptop binding before day one. Staging buys day-one readiness at the cost of a cleanup job. I'd stage for anyone who needs a mailbox or external meetings before their start date, and JIT contractors and short engagements. The deciding question is whether anything must exist before the person can log in.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-4

Design a mover workflow that prevents access accumulation.

Answer

A mover workflow prevents access accumulation by treating every move as a full desired-state recomputation plus a diff, not as an add-only provisioning event. The core answer: one authoritative effective-dated HR event triggers a recompute of the target entitlement set from the new role and attributes; the IGA diffs that against actual grants in every connected target; obsolete grants are revoked before or atomically with additions when they are high-risk; privilege-bearing attributes and sessions are updated; reconciliation and stale-access duration close the loop.

Assumptions: HR is authoritative and effective-dated; an IGA such as SailPoint IdentityIQ, Okta Identity Governance, or Microsoft Entra ID Governance has connectors to targets; roles and entitlements are mapped; SoD policy exists. If no IGA, the same logic runs in scripts, but connector coverage and reconciliation are the hard parts.

Why access accumulates: revokes do not cascade to nested groups, app-local roles, direct assignments, or shared accounts; sessions and tokens keep old claims until expiry; birthright groups are not recalculated; out-of-order mover events apply an old delta after a newer one. A delta-based workflow ("remove old dept, add new dept") misses these. Desired-state recomputation catches them because it asks what the user should have now, not what changed.

Workflow:

  1. Consume event. Validate effective date and sequence. Ignore stale events.
  2. Recompute desired state from new attributes and roles. Expand nested groups.
  3. Diff actual vs desired. Classify: retained, new, obsolete, exceptional, conflicting.
  4. Route sensitive decisions: SoD conflicts, toxic combinations, exceptions to owner.
  5. Order changes. High-risk obsolete access (prod admin, financial approval, PII) revoke-before-add or atomic. Low-risk add-then-revoke within SLA. Example policy: high-risk revoke SLA 15 minutes, low-risk 24 hours.
  6. Update privilege-bearing attributes: group membership, role assignments, sudoers, AWS IAM roles, DB roles. Revoke sessions and tokens.
  7. Reconcile targets. Notify owners. Measure stale-access duration.

Worked trace (hypothetical): Alice moves Payments to Fraud effective 2025-06-01.

GrantActual beforeDesired afterDiff
payments-readyesnoobsolete
payments-deployyesnoobsolete
payments-admin (AWS role)yesnoobsolete, high-risk
fraud-read via all-engyesyesretained
fraud-deploynoyesnew

payments-admin is high-risk, so revoke at 00:00 and revoke sessions; fraud-deploy added at 00:05. Stale duration for payments-admin = 0. If fraud-deploy conflicts with payments-admin under SoD, the conflict routes to owner before add.

Failure modes:

  • Two movers same day: Alice Payments to Fraud, Bob Fraud to Payments. Independent deltas leave both with both teams. Detection: daily reconciliation diff shows union. Fix: recompute from latest HR state per user, not event delta.
  • Out-of-order events: old event arrives after new. Detection: sequence and effective date; stale event ignored.
  • Session survives: app logs show old role claim after revoke. Detection: post-change access test; fix: revoke sessions and tokens on privilege change.
  • Nested group not revoked: user still in parent group. Detection: leaf-level entitlement reconciliation; fix: expand groups.
  • App-local entitlement not in IGA: detection: periodic full reconciliation; fix: connector coverage.

Trade-offs: revoke-before-add prevents overlap but can break continuity; atomic needs target transaction support; add-then-revoke is smoother but leaves a window. Decide by risk: toxic, SoD, or prod admin access goes revoke-before-add or atomic; low-risk access with immediate need goes add-then-revoke within SLA. Approved overlap must be time-bound, owner-approved, logged, and auto-expire.

Test rapid successive moves and out-of-order events with reconciliation assertions: after each event, actual equals desired; stale-access duration stays under SLA.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-6

Design normal and immediate leaver workflows.

Answer

Assume HRIS (Workday) is source of truth, IdP is Okta or Entra ID, downstream apps via SCIM 2.0, privileged access in CyberArk, local accounts in AD and Linux. Legal hold is separate from login.

Core answer: Normal leaver is a scheduled workflow with a known last day. Immediate leaver is an incident response workflow that starts now.

Normal leaver: T-14: HRIS termination event creates ticket. Owner: IT identity team. Pre-work: manager lists direct reports, shared mailboxes, distribution lists, file ownership. T-7: manager transfers Google Drive/SharePoint ownership, reassigns Jira tickets, updates on-call. Owner: manager. T-1: disable privileged access (PAM check-in, remove from AWS admin roles), rotate shared secrets the leaver knew. Owner: security. T-0 17:00 local: IdP deactivate (Okta Deactivate, Entra ID Block sign-in). This stops new auth. Then revoke refresh tokens and sessions (OIDC back-channel logout, Okta clear sessions). SCIM pushes active=false to connected apps. Disable AD account (Disable-ADAccount). Suspend Google Workspace user. Deactivate AWS IAM access keys and delete login profile. Owner: identity team. T+1: reconcile: compare HRIS leavers to app user lists; manual deprovision non-SCIM apps. Owner: identity team.

Immediate leaver: T-0: HR/security calls. Owner: security on-call. First action: disable IdP sign-in (Okta Deactivate, Entra ID Block sign-in) within 5 minutes. This stops new auth. Then revoke all sessions and refresh tokens within 15 minutes. Kill VPN (Cisco AnyConnect, Palo Alto GlobalProtect) by disabling user. Disable AD account. Deactivate AWS keys. Rotate shared secrets within 1 hour. Isolate high-risk targets: remove from production admin groups, revoke SSH keys, disable CI/CD tokens, transfer source code ownership. Owner: security + platform. T+1: reconcile within 24 hours. Legal hold: preserve mailbox and Drive, but block login.

Mechanism: Disabling sign-in stops new authentication but existing access tokens remain valid until expiry. Access tokens often 1 hour; refresh tokens can last days. So you must revoke sessions and refresh tokens. SCIM deprovisioning is push; apps without SCIM need pull reconciliation. Shared secrets are not tied to identity, so rotation is the only fix.

Tradeoffs: Normal leaver preserves knowledge transfer but leaves a window for data exfiltration. Immediate leaver closes the window but disrupts operations and can tip off the leaver. Deciding criteria: access to production, customer data, secrets, or admin privileges. If a normal leaver holds any of those, run the immediate workflow at T-0 even if last day is later. Contractors: shorter T-14, often T-1.

PhaseNormal leaverImmediate leaver
T-14HRIS event, ticketN/A
T-7Manager transfers ownershipN/A
T-1Disable privileged access, rotate shared secretsN/A
T-0IdP deactivate at 17:00, revoke sessions, SCIM push, disable AD, suspend Google, deactivate AWS keysIdP deactivate within 5 min, revoke sessions within 15 min, kill VPN, disable AD, deactivate AWS keys, rotate shared secrets within 1 hour, isolate high-risk targets
T+1Reconcile, manual deprovisionReconcile within 24 hours

Failure modes:

  • Orphaned SaaS accounts: app not SCIM-connected. Detect: monthly reconciliation report comparing HRIS leavers to app user lists. Cost: one manual ticket per app.
  • Long-lived refresh tokens: user still accesses after disable. Detect: IdP sign-in logs show successful auth after deactivation. Fix: revoke refresh tokens, set max session lifetime.
  • Shared credentials not rotated: leaver knows shared password. Detect: PAM audit or secret scanning. Cost: rotate and redistribute.
  • Local accounts on servers: not disabled. Detect: configuration management (Ansible) or vulnerability scan. Cost: manual disable per host.
  • Data loss: disabling account deletes mailbox/OneDrive. Detect: legal hold or retention policy. Cost: restore from backup.
  • Ownership gaps: files owned by leaver. Detect: Google Drive/SharePoint ownership report. Cost: manager reassigns.

Worked example (hypothetical figures): 5,000-employee company. Normal leaver touches 40 SaaS apps; 30 SCIM-connected, 10 manual. Immediate leaver SLO: disable IdP within 5 min, revoke sessions within 15 min, rotate shared secrets within 1 hour, reconcile within 24 hours. In a drill, the 10 manual apps took 3 days to reconcile; adding SCIM for the top 5 reduced to 4 hours.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-7

Choose disable, archive, and delete semantics.

Answer

What I'd say first

Assume a mid-size SaaS estate: Workday as HR system of record, Okta or Entra ID as the IdP, and 40–80 downstream apps (Salesforce, GitHub, AWS, Slack) that each hold their own copy of the person. The question is which of three verbs (disable, archive, delete) applies to which copy, and in what order.

My answer: disable is immediate and reversible; archive is a bounded retention state; delete is irreversible and only legal once retention has expired. They are not three names for the same thing, and the order is forced: you cannot delete the IdP record before you have used it to find and remove the downstream accounts.

Why the order is forced

Deprovisioning is a graph traversal, not a single write. The IdP record holds the correlation key (the immutable object ID (Entra objectId, Okta user ID) plus the email/UPN) that maps a person to their accounts in Salesforce, GitHub, AWS. Delete that record first and you lose the key; the downstream accounts become orphans nobody can attribute to a leaver. That is the mechanism behind "disable before delete."

Disable: set the account to a non-authenticating state and revoke sessions. In Okta that's DEACTIVATED; in Entra ID it's accountEnabled: false. Neither kills an already-issued OAuth refresh token in a downstream app, so disable must be paired with per-app session revocation (Okta DELETE /api/v1/users/{id}/sessions, or the app's own token revocation endpoint).

Archive: keep the identity record and its target mappings, strip or encrypt the PII, and hold it under a retention clock. This is where the numbers live. Entra ID soft-deletes users for 30 days and blocks UPN reuse during that window. Google Workspace gives 20 days to restore a deleted user. Okta keeps deactivated users indefinitely: there is no built-in TTL, so if you want archive to expire you have to build the job.

Delete: purge the PII once retention expires. GDPR Art. 17 gives a right to erasure; Art. 5(1)(e) says keep it no longer than necessary. SOX says 7 years for financial records; HIPAA says 6 years. SOC 2 prescribes no period: it asks you to prove you follow your own.

Table

VerbWhenWhat survivesReversible
DisableDay 0, on terminationFull record, mappingsYes
ArchiveDay 0 to retention expiryIdentity + mappings, PII encryptedYes, within window
DeleteAfter retentionTombstone: immutable ID, no PIINo

Worked trace

Leaver on Day 0. 09:00 disable in IdP, revoke sessions. 09:05 reconciliation job diffs HR roster against IdP and app assignments; expected diff = 1 leaver, 3 app accounts. Job removes the 3. Day 30: archive. PII encrypted, record retained. Day 365: delete. PII purged, tombstone row kept with the immutable ID so a rehire or a UPN reuse cannot silently inherit the old person's history.

Failure modes and detection

  • Orphaned accounts: reconciliation diff stays > 0 after the run. Alert on it; that's the signal.
  • UPN reuse collision: a new hire gets a leaver's old UPN, and downstream systems keyed on email attach the old person's data. Detected as a create failure in Entra during the 30-day window (the UPN is still held), or as duplicate-key errors in the app.
  • Premature delete: auditor asks for the access history of a leaver and the record is gone. Detected at access-review time, which is too late, so gate delete on a retention check, not on a ticket.

Trade-off

Disable-only is cheap and safe but accumulates licenses and PII indefinitely: a privacy liability. Hard delete immediately is clean but breaks reconciliation and audit. Soft delete with a TTL is the usual middle: Entra's 30 days, Google's 20, or a custom job in Okta. Pick the TTL from the strictest obligation that applies to the data, not from the IdP's default.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-5

Implement time-bound lifecycle grants.

Answer

Core answer

Clarify two things first: does the target enforce expiry itself (IAM condition, Vault lease TTL, short-lived token), and who owns the clock? Assume we run a control plane that grants access into targets that expose an API but not always native expiry.

The answer: model each grant as a row with a hard ends_at timestamp, provision it idempotently, and run a reconciler that both expires grants and detects drift. The load-bearing decision is that expiry should be enforced by the target wherever it can be, with the control plane as a backstop, not the other way round.

Mechanism

Idempotent provisioning: key the grant by a deterministic ID (e.g. grant:{principal}:{role}:{start_epoch}) and use the target's idempotency key or a create-if-absent call. A retry after a timeout then converges instead of stacking duplicate role bindings.

Native expiry beats controller expiry. If the target supports it, encode the end time in the grant itself:

  • GCP IAM Conditions: request.time < timestamp("2025-01-01T00:00:00Z").
  • Vault: lease ttl/max_ttl. The lease dies on its own.
  • Kubernetes bound ServiceAccount tokens: expirationSeconds (default 3600).
  • AWS IAM Identity Center: permission-set session duration 1–12 hours, default 1 hour.

A grant that expires in the target survives a control-plane outage. A grant that only the controller expires does not.

Reconciliation: the reconciler reads desired state (grants where ends_at <= now and state = active) and actual state (target API), then converges. Drift is any grant active in the target past ends_at, or a grant the controller thinks is active but the target already dropped. Run it on a short interval (e.g. every 60s) and alert on lag.

Revocation propagation: revoking a role does not revoke sessions already minted from it. Either keep token TTLs short so the stale window is bounded, or call the target's session-revocation API. State the stale window explicitly.

Trade-offs

Native TTL: survives outage, coarse granularity, target-specific. Controller-driven: uniform across targets, flexible, but a single point of failure and it adds a stale window equal to the reconcile interval. Use controller-driven only for targets with no native expiry, and keep the interval short.

Renewal: auto-renew silently defeats time-bound access. Require fresh justification and approval, and cap total lifetime.

Failure modes

  • Control plane down at expiry → grant persists. Detect via reconciler lag metric; mitigate with native TTL.
  • Clock skew between control plane and target → early or late expiry. Use UTC and allow a skew window (e.g. ±60s); don't rely on wall-clock equality.
  • Target outage during revocation → queue and retry, alert if a grant stays active past ends_at + grace.
  • Extension racing with expiry → compare-and-swap on a version column so an extend and an expire can't both win.

Artefact: reconciler trace

now = 12:00:00Z
grants: g1 ends_at 11:59:30 state=active   -> expire
        g2 ends_at 12:30:00 state=active   -> leave
target: g1 present, g3 present (unknown)   -> revoke g1, alert on g3

g3 is drift: active in the target with no matching row. That is the case an audit would otherwise catch months later.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-15

Handle rehire without account takeover or stale privilege.

Answer

The 90-second answer

Two problems hide in one rehire ticket. Account takeover: someone claims a returning person's identity to get their old mailbox, files, and SSO. Stale privilege: the returning person is genuinely who they say, but last year's entitlements get switched back on. Handle them separately: re-prove the human, then build a new relationship from scratch.

Assumptions I'd state up front: HR is the system of record and the rehire is already there with a new hire date; the prior relationship ended with a termination event; the person's legal identity is unchanged.

Direct answer: re-run identity proofing at the IAL the new role requires (NIST SP 800-63A. IAL2 for most staff roles), bind the result to a new identity record, and derive entitlements from the new role's attributes only. Never flip the old account back to active.

Why proofing is not authentication

Authentication proves control of an authenticator. Proofing proves the subject is the person the record describes. A rehire has no valid authenticator, the old one was revoked at termination, so you cannot authenticate your way to the answer. You proof: government ID plus a selfie match, or a video call with an authorized agent, at the IAL the role demands. Only after proofing do you issue a fresh authenticator.

Why session kill must be explicit

Most SSO access tokens are stateless JWTs: the resource server verifies signature and expiry and never calls back to the IdP. Disabling the account in the directory does nothing to a token already in flight. Take an example config of a 15-minute access token and a 30-day refresh token. If you only disable the account, the refresh token keeps minting access tokens for up to 30 days. So termination, and rehire, must revoke refresh tokens and bump a token-version claim the resource servers check, or you accept a bounded window and shorten it.

How recomputation actually works

Entitlements are derived, not stored as truth. Role plus attributes (department, cost center, location, employment type, sponsor for contractors) feed group memberships, which feed downstream accounts. The trap is reactivating the old account row: it carries the old attribute snapshot, so the derivation reproduces last year's access. Create a new relationship record with the new hire date and re-derive. Retained business data (the person's old files, tickets) is a separate decision, granted by explicit transfer, not by inheritance.

Trade-offs

Hard match on government ID is slow and expensive; soft match on name, DOB, and last-4 is fast and is exactly the takeover attack surface. Decide by role risk: IAL2 proofing for anyone touching production or customer data, soft match plus manager attestation for low-risk rehires. Second trade-off: auto-reactivate is cheap and wrong; new-record-plus-recompute costs a support ticket and is right.

Failure modes and detection

  • Recycled email: the old alias still routes password reset to a device the previous holder controls. Detect by alerting when a reset is requested for an address whose prior relationship is terminated.
  • Duplicate worker ID: HR issues a new ID, and SCIM configured to match on email links to the old account. Detect with a reconciliation report of HR IDs against directory IDs.
  • Contractor-to-employee conversion: the contractor account had a sponsor-based exception that survives. Detect with an entitlement baseline diff against the new role.

Artefact: what carries over

ItemRehire
Legal identityRe-proved, same subject
AuthenticatorsNew, issued after proofing
Sessions / refresh tokensRevoked at termination, never restored
Group membershipsRe-derived from new role
Mailbox / filesExplicit transfer decision
Worker IDNew relationship record

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-18

Provision groups without hidden privilege expansion.

Answer

Core answer (first 90 seconds)

Provisioning a group is safe only if you provision its effective membership, not its name. Hidden privilege expansion is what happens when the target resolves group nesting differently from your source of truth, so a group you think grants "VPN access" transitively reaches a privileged group. The rule: compute the transitive closure of membership under each target's real expansion semantics, tag any group whose closure reaches a privileged entitlement as privileged itself, and refuse to write until that closure matches the intended entitlement set.

Assumptions: source of truth is an IdP (Okta or Entra ID) with flat groups; targets are Active Directory (stores and expands nesting) and SaaS apps reached over SCIM 2.0 (RFC 7643/7644, no standard nesting). Membership is pushed by directory sync or SCIM.

Mechanism: targets expand nesting at different points

That timing decides whether a nested group grants anything:

  • Preserve-and-expand-at-read: AD stores the nested group and expands it at logon into the Kerberos PAC. A nested group grants everything its parents grant.
  • Flatten-at-write: most SCIM apps resolve nesting once, at write time, and store direct members. Later changes to the parent don't propagate.
  • Ignore-nesting: Entra ID group-based licensing and app assignment do not expand nested groups. A nested group grants nothing. Okta groups are flat; you use group rules instead.

So the same source graph yields different effective sets per target. Hidden expansion is the case where the target's closure contains a privileged group your model didn't.

TargetNesting storedExpandedNested group grants
Active DirectoryYesAt logon, into Kerberos PACYes
Entra ID licensing / app assignmentNo—No
Okta groupsNo (flat; group rules)—No
SCIM 2.0 SaaS appImplementation-specific; usually flattened at writeAt writeUsually no

Worked trace

Source IdP: user ana added to eng-oncall. Target AD already has eng-oncall nested into VPN-Users, which is nested into Domain Admins (added years ago, never reviewed).

Closure under AD semantics: ana → eng-oncall → VPN-Users → Domain Admins. Provisioning the single membership grants Domain Admin. Under Entra app assignment the same write grants nothing, because nesting is ignored: the two targets disagree, and only the AD closure is dangerous.

Detection: before writing, compute closure and diff against the group's tagged entitlement set. eng-oncall is tagged vpn; closure reaches domain-admin, so the write is blocked and the nesting edge is flagged for review.

Failure modes

  • Token bloat: AD packs group SIDs into the PAC; MaxTokenSize defaults to 48000 bytes. Deep or wide nesting pushes a user past it and logon fails or the token is truncated, silently dropping memberships.
  • Cycles: A→B→A. Preserve-and-expand targets loop or error; flatten targets may recurse until timeout. Block self-membership and cycles at write.
  • Partial sync: a SCIM bulk write fails midway; some members written, some not. Reconcile by re-reading target state and diffing, not by replaying blindly.
  • Rename: name-based mapping breaks when a group is renamed; map by immutable ID.

Trade-offs

Flattening is simpler and bounds token size but loses propagation: a parent change needs a re-push. Preserving nesting matches AD semantics but makes every parent edge a privilege edge, so it needs closure review on every change. When the target ignores nesting (Entra licensing), don't model nesting at all: model direct membership only, or you'll block writes that are actually safe.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-10

Implement and test SCIM PATCH.

Answer

The 90-second version. SCIM PATCH is RFC 7644 §3.5.2: PATCH /Users/{id} with a body whose schemas is ["urn:ietf:params:scim:api:messages:2.0:PatchOp"] and whose Operations array is applied in the order received. Three ops: add, replace, remove, all case-insensitive. I implement it as: parse and validate every operation against the schema first, apply them in order inside one transaction, bump meta.version, return the updated resource. Any validation failure returns a SCIM error and persists nothing. Assume SCIM 2.0, JSON, a User with the enterprise extension, and ETag concurrency via If-Match.

Parsing. op is required. path is optional for add/replace (when absent, value is a map of attributes) and required for remove. value is required for add/replace. The path grammar is [URI ":"] attrName ["." subAttr] or attrName[valFilter]: e.g. name.givenName, urn:ietf:params:scim:schemas:extension:enterprise:2.0:User:employeeNumber, members[value eq "2819c223-7f76-453a-919d-413861904646"]. Attribute names are case-insensitive; the filter grammar technically allows eq/ne/co/..., but valuePath in practice is [value eq "..."].

Validation, with the error each one produces. id, meta, schemas are readOnly → 400 mutability. Wrong type or non-canonical enum (e.g. emails[].type) → 400 invalidValue. Removing a required attribute → 400 invalidValue; a path that matches nothing → 400 noTarget. userName collision → 409 uniqueness. Caller lacks write on the target attribute → 403. Stale If-Match → 412. Error body:

JSON
{"schemas":["urn:ietf:params:scim:api:messages:2.0:Error"],
 "scimType":"noTarget","detail":"members[value eq ...] matched no entry","status":"400"}

Worked trace.

HTTP
PATCH /Users/2819c223-7f76-453a-919d-413861904646
If-Match: W/"e180ee84f0671b1"

{"schemas":["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
 "Operations":[
   {"op":"replace","path":"active","value":false},
   {"op":"add","path":"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User:employeeNumber","value":"701984"},
   {"op":"remove","path":"members[value eq \"2819c223-7f76-453a-919d-413861904646\"]"}]}
  1. If-Match equals stored meta.version → proceed; mismatch → 412.
  2. Op 1: active is readWrite boolean → set to false.
  3. Op 2: extension object absent → create it, set employeeNumber="701984". add on a single-valued attribute behaves like replace.
  4. Op 3: the valuePath selects the member whose value sub-attribute equals the id; it matches → remove that entry. No match → 400 noTarget.
  5. Commit, mint a new meta.version, return 200 with the full resource.

Tests.

caserequestexpected
add over existing single valueadd activevalue replaced
remove without pathremove400 noTarget
valuePath no matchremove members[value eq "nope"]400 noTarget
readOnly targetreplace id400 mutability
userName collisionreplace userName409 uniqueness
stale ETagIf-Match mismatch412
multi-valued addadd membersappends, dedupes by value
malformed filtermembers[value gt "x"]400 invalidFilter
cross-tenant idPATCH another tenant's id404, not 403

Concurrency and trade-offs. Two PATCHes with the same If-Match: one commits, the other gets 412. Without If-Match it is last-write-wins unless you take a row lock. The RFC requires in-order application; the safe reading is all-or-nothing, so validate the whole list, then commit under one lock. If the store can't do multi-attribute transactions (some NoSQL), you either serialize the resource under a lock or run a saga with compensating writes: the lock is simpler and the failure mode (a half-applied resource visible to a concurrent read) is worse than the contention.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-8

Implement idempotent SCIM provisioning.

Answer

Core answer

Assume the IdP (Okta, Entra) is the source of truth, the SCIM server is the target, and the transport is HTTP where a request can succeed and the response can be lost. Idempotent provisioning means: replaying the same desired state any number of times leaves exactly one resource with the same attributes.

Three parts.

  1. Stable external identity. Every resource carries externalId set to the IdP's immutable ID (Okta's user.id, Entra's objectId) not the email or username, which change. Before any create, the client runs GET /Users?filter=externalId eq "00u1a2b3c" (RFC 7644 §3.4.2.2). One result means the create is a no-op or an update; only an empty result authorizes POST /Users.

  2. Reconcile after uncertainty. A timeout or connection reset is not a failure: it is unknown. On unknown, re-run the filter lookup instead of retrying the POST blindly. The lookup is the idempotency check.

  3. Converge on desired state. For updates, compute the target state and send it; never send a delta you cannot replay.

Why the lookup makes create safe

The dangerous window is: POST succeeds server-side, the response is lost, the client retries. Without a lookup you get two users. With it, the retry's filter finds the first user and stops. This only holds if the server enforces uniqueness on externalId: RFC 7643 defines externalId as client-assigned but does not require uniqueness, so confirm the target enforces it (many return 409 with scimType: "uniqueness"). If it does not, the filter can return several rows and you need a tie-break, e.g. oldest meta.created.

Trace: lost response

  1. Client: POST /Users {externalId: "00u1a2b3c", userName: "ada@corp.com"}.
  2. Server creates the user, returns 201 with Location: /Users/2819c223. A proxy drops the response.
  3. Client times out at 10s. Treats it as unknown, not failure.
  4. Client: GET /Users?filter=externalId eq "00u1a2b3c" → 200, one resource, id 2819c223.
  5. Client records the mapping and moves on. One user exists.

PATCH vs PUT

PUT replaces the whole resource: replaying it is naturally idempotent, but you must send every attribute and a stale PUT can clobber a concurrent change. PATCH (RFC 7644 §3.5.2) sends only the changed paths and applies operations in the order given, but add to a multi-valued attribute is not idempotent by itself: replaying add member can duplicate. Prefer replace on the specific path, or compute the full target set and replace it. Use If-Match with the resource's version (ETag) for optimistic concurrency; a mismatch returns 412, which tells you to re-read and recompute rather than overwrite.

Error handling

  • 409 + scimType: "uniqueness" → not retryable; reconcile.
  • 400 / invalidValue → poison record; quarantine, do not retry.
  • 429 / 503 with Retry-After → retryable; honor the header, else exponential backoff from 1s, cap 30s, full jitter.
  • 412 → re-read, recompute, retry once.

When not to use this

If the target has no externalId uniqueness and no ETag support, fall back to write-side idempotency keys (a client-generated request ID stored server-side) or a reconcile-on-read sweep. Heavier, but they do not depend on server cooperation.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-11

Secure a SCIM endpoint and its client credentials.

Answer

Assumptions

SCIM 2.0 endpoint (RFC 7644) fronting a multi-tenant SaaS. The client is a confidential server-side provisioning agent (Okta, Entra ID, or an in-house sync job) never a browser. You control credential issuance and the SCIM server.

Core answer

Treat the SCIM client credential as a high-impact machine identity, not a config string. Issue it through the OAuth 2.0 client credentials grant (RFC 6749 §4.4) so the long-lived secret never appears on the SCIM request path; each SCIM call carries a short-lived access token, a 15-minute TTL is a reasonable default, bound to exactly one tenant. Require TLS 1.2+ (1.3 where the IdP supports it), prefer mTLS (RFC 8705) or DPoP (RFC 9449) over a bare bearer token, authorize per HTTP method and per resource, rotate with an overlap window, and audit every mutation with client ID and operation.

Mechanism

The IdP authenticates to your token endpoint with its client credential and receives a JWT access token whose aud is the SCIM base URL and whose claims include tenant and scope (scim.read, scim.write). The SCIM server validates signature, exp, aud, and iss, then checks the tenant claim against the resource's tenant before touching the database. That check is what enforces partitioning, not a URL prefix, which a client can forge.

Authorization is per method: GET/HEAD need scim.read; POST/PUT/PATCH/DELETE need scim.write. Advertise capabilities in /ServiceProviderConfig (RFC 7644 §5) so the IdP knows whether you support PATCH, bulk, and ETag-based concurrency.

Trade-offs

CredentialBindingRotationWrong when
Static bearer secretNoneManual, needs overlapClient can do better; never for a browser
OAuth client credentials + short JWTaud + tenant claimAutomatic, 15-min TTLIdP can't speak OAuth (rare)
mTLS (RFC 8705)Cert thumbprintCert rotation, daysNo PKI to distribute certs
Workload identity (SPIFFE/OIDC)Workload attestationAutomaticNon-cloud, no workload platform

Pick mTLS or workload identity when you can; fall back to a rotated secret only when the IdP forces it.

Failure modes

  • Token in logs. Bearer tokens leak through access logs, error traces, and CI output. Detect with log scanning for Authorization: Bearer and secret scanning in CI. Cost: full credential compromise until rotation.
  • Leaver blocked by throttling. A per-tenant rate limit that also throttles DELETE /Users/{id} keeps a terminated employee active. Detect by alerting on p99 time from HR termination event to SCIM 204; page if it exceeds 5 minutes. Exempt deletes from the limit.
  • Rotation without overlap. Revoking the old secret before the IdP picks up the new one produces a 401 spike. Keep the old secret valid for at least the access-token TTL plus the IdP's refresh interval: 15 min TTL + 10 min refresh = 25 min, round to 30.
  • Cross-tenant token reuse. A token minted for tenant A used against tenant B. Detect by alerting whenever the token's tenant claim differs from the resource's tenant.

Worked check

Python
# Python 3.12, PyJWT 2.8
import jwt

def authorize(token: str, tenant_id: str, method: str) -> bool:
    claims = jwt.decode(
        token, key=PUBLIC_KEY, algorithms=["RS256"],
        audience="https://scim.example.com",
        options={"require": ["exp", "aud", "iss", "scope", "tenant"]},
    )
    if claims["tenant"] != tenant_id:
        return False
    scopes = set(claims["scope"].split())
    if method in ("GET", "HEAD"):
        return "scim.read" in scopes
    return "scim.write" in scopes

Trace: a token with tenant="acme", scope="scim.write", method DELETE → decode passes, tenant matches, method is not GET/HEAD, scim.write present → True. The same token against tenant_id="globex" → False at the tenant check. A scope="scim.read" token with method DELETE → False at the scope check. Three calls, three distinct rejection points.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-14

Design event ordering for lifecycle automation.

Answer

Assumptions (state these in the first 30 seconds)

  • HR is the system of record for employment status; a contractor tracker and manual admin actions are secondary sources.
  • Transport is Kafka with at-least-once delivery: duplicates and reordering are the normal case, not an exception.
  • No two sources share a clock. Okta's System Log carries a published timestamp, Workday carries effective dates, and neither is monotonic with delivery order.
  • Fan-out targets: Okta/AD, Google Workspace, Slack, AWS IAM.

Core answer

Order by principal, not by arrival. Partition the stream by principal ID so every event for one identity lands in one Kafka partition: Kafka guarantees order only within a partition. Then define a total order per principal as the tuple (source_priority, effective_time, source_version, event_id). Finally, make every handler recompute desired state from the authoritative source rather than applying the event as a delta. A stale event then becomes a no-op instead of a wrong write.

Why recompute beats replay

An imperative event says "disable account E-4471". A recompute handler says "read HR for E-4471, read current IdP state, converge". The second is idempotent by construction: applying it twice, or after a newer event, produces the same result. That is what makes at-least-once delivery survivable: you stop needing exactly-once, which you cannot get across a Kafka topic and four SaaS APIs anyway.

Version guards are the cheap first line. SCIM 2.0 (RFC 7644 §3.14) exposes meta.version as an ETag and accepts If-Match; a mismatch returns 412 Precondition Failed. Store the last applied version per principal and park anything older.

Worked trace (illustrative)

E-4471, terminated effective 2025-03-31, rehired effective 2025-04-14.

recordedeventarrives
03-10 14:02ZHR termination, effective 03-31, version v704-15 08:00Z (delayed)
03-11 09:15ZHR rehire, effective 04-14, version v904-14 10:00Z

Arrival order is rehire then leaver. Last-write-wins by arrival disables an active employee on 04-15. Ordering by effective time puts the leaver (03-31) before the rehire (04-14), so the final state is active. The version guard catches it earlier still: v7 < v9, so the leaver is parked, never applied. And if it slipped through, the recompute handler reads HR, sees active, and writes nothing.

Note the future-dated case: the rehire is effective 04-14 but recorded 03-11. Future-dated events go to a scheduler, not the handler: applying them on arrival is the bug that makes "terminate then rehire" look like a resurrection.

Options and when each is wrong

ordering keyright whenwrong when
arrival timesingle source, no retriesany retry, any second source, any skew
source effective timesource is effective-dated (Workday)manual admin actions with no effective date
source version / ETagsource exposes a monotonic version (SCIM)source versions reset on migration
Lamport / hybrid logical clockno trustworthy wall clockyou must compare against a human SLA

Failure modes, detection, cost

  • Stale rehire resurrects access. Detect with a nightly reconciliation of HR active workers against IdP active accounts; alert on any account active in the IdP but not in HR. Cost: a SOX ITGC or ISO 27001 access-review exception, and mean time to detect equals the reconciliation interval. 24 hours if nightly.
  • Poison event blocks a partition. A malformed event retried forever at the head of a partition freezes every identity in it. Detect by partition-level consumer lag diverging from the rest. With 40k identities over 64 partitions, that is ~625 people who stop provisioning. Fix: retry N times, then park the identity (not the partition) in a DLQ keyed by principal.
  • Rebalance reprocessing. Detect by counting provisioning calls per principal per hour; anything above 1 is a duplicate. Cost: duplicate SaaS seats and duplicate welcome mail.
  • Clock skew between sources. Monitor max |source timestamp − broker ingest time|; alert past 2 minutes. Cost: last-write-wins silently picks the wrong source.
  • Multi-source conflict. HR says active, the contractor tracker says ended. Resolve by declared source precedence, and have reconciliation flag identities present in two sources with conflicting status.

Dedupe on (source, event_id) with a window at least as long as topic retention: Kafka's default log.retention.hours is 168, so seven days. Producer-side, enable.idempotence=true (default since Kafka 3.0) plus max.in.flight.requests.per.connection ≤ 5 keeps retries from reordering a partition.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-13

Handle retries, dead letters, and poison lifecycle records.

Answer

Assumptions. Lifecycle records are joiner/mover/leaver events from an HRIS fanning out to targets (Okta, AD, Google Workspace, SaaS apps) through a queue, keyed by principal id, delivered at least once. Targets are HTTP APIs. If your pipeline is different, the classification below still holds; the numbers are the ones I'd start from.

Core answer (first 90 seconds). Split the failure before you retry anything: is this a delivery failure or a processing failure? Delivery failures (5xx, 429, connection reset, timeout) are worth retrying with bounded exponential backoff and jitter. Processing failures (400/422, schema violations, business-rule rejections) are deterministic; retrying them burns the queue and delays everything behind them. Retry only operations that are idempotent or carry an idempotency key. When attempts are exhausted, move the event to a DLQ with enough context to act on it, and keep the rest of the partition moving. Replay is not "resend the old event": re-read the current authoritative state from the HRIS and reconcile, because a three-day-old leaver event replayed after a rehire would disable an active employee.

ErrorRetry?DestinationDetection
5xx, timeout, connection resetyes, backoffsame queueattempt counter
429yes, honour Retry-Aftersame queueresponse header
400/422 schema or business rulenoDLQ on first attemptfirst attempt
404 on a disable/deleteno: treat as success—idempotent delete
409 conflictonce, after re-reading statesame queueversion mismatch

Backoff arithmetic. Base 1 s, multiplier 2, full jitter, cap 5 min, max 8 attempts: 1+2+4+8+16+32+64+128 = 255 s ≈ 4.3 min of sleeping per event. The cap is not decoration: uncapped, attempt 12 sleeps 68 min and outlives the queue's retention.

Trace: transient. leaver u-4471 → okta (disable + revoke sessions).

  • t0 attempt 1 → 503 → retry
  • t0+1 s attempt 2 → 503 → retry
  • t0+3 s attempt 3 → 429, Retry-After: 30 → sleep 30 s, not the 4 s the backoff would give
  • t0+33 s attempt 4 → 200. Done in 4 attempts, 33 s.

Trace: poison. leaver u-9001 → okta, payload has employeeId: null from an HRIS bug. Attempts 1–5 all return 400 employeeId required with the same payload hash. That signature (same error class, same hash, ≥3 attempts) is the poison detector. After maxReceiveCount the event lands in the DLQ with source snapshot, target response, owner, and the safe operator actions (fix payload, replay, or discard).

Queue mechanics that bite. On SQS, set the visibility timeout above the longest single attempt (30 s client timeout → 60 s visibility) and a redrive policy with maxReceiveCount 5. DLQ retention defaults to 4 days (max 14): a DLQ nobody drains for four days silently deletes the evidence. Kafka has no redrive; you build retry topics. max.poll.interval.ms defaults to 300000, so sleeping five minutes inside the poll loop evicts the consumer, triggers a rebalance, and the record is redelivered to another consumer while the first is still working: duplicate provisioning.

Trade-offs. In-place retry preserves per-principal order but blocks the partition; retry topics keep throughput but lose order, so you need a version or sequence number on the event and the target must reject stale writes. Pause the consumer instead of retrying when the target outage is measured in hours: the queue buffers and order survives, whereas DLQ replay is manual and unordered. Fix forward from the source topic, not the DLQ, when the bug is in your own code. A target outage dumping 50k events into a DLQ is a backlog, not a poison set.

Failure modes. Head-of-line blocking: one poison leaver at offset 100 in a 5,000-event partition stalls 4,900 events and new hires can't log in on day one. Thundering herd: 200 workers retrying a 429 at the same instant without jitter. Stale replay: the rehire case above. Duplicate create: SCIM POST /Users retried after a timeout creates two accounts. PUT is idempotent, POST is not, so retry the PUT.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-12

Design lifecycle reconciliation.

Answer

Core answer

Assume HR (Workday) is authoritative for employment, Okta is the hub, and three downstream targets get provisioned: Google Workspace, AWS IAM Identity Center, GitHub Enterprise. Reconciliation is a separate read-only job on a schedule; it never sits in the provisioning path, because a bug there blocks joins.

State the assumptions first (which system is authoritative, which key is stable, what a wrong delete costs) then answer in three phases.

  1. Snapshot desired. Pull the authoritative set: active workers with a hire date ≤ today and no termination date, plus the policy layer (which groups and roles each worker should hold). Key it on the HR worker ID, which never changes.

  2. Snapshot actual. Walk each target's API to completion. This is where most implementations break: SCIM list endpoints paginate with startIndex/count (RFC 7644 §3.4.2.4), and the provider may cap count below what you asked for. Stop early (a 429, a timeout) and your "actual" set is truncated, so every account past the cut looks extra.

  3. Diff and classify on a stable key. Match on the IdP's externalId (SCIM externalId, RFC 7643 §3.1), which the provisioning client controls and keeps stable, or on the HR worker ID. Never match on email. Email changes on renaming or a domain migration, and matching on it turns a rename into delete+create, which drops group memberships and re-fires every downstream provisioning rule.

Classification and action

classsignaldefault action
missingdesired, not in actualauto-create
extrain actual, not desiredauto-disable after 7-day grace, delete after 30
stalepresent, wrong groups/rolesauto-fix if additive; page owner if it removes access
conflictingtwo accounts, one externalIdquarantine, never auto-merge
orphanno externalId, no HR matchquarantine, page owner

The deciding criterion for auto vs manual is reversibility and blast radius. Creating an account is cheap and reversible; deleting one destroys data and audit history, so the default is disable-then-delete with a grace window. Anything that removes access from a human, or that you can't map to a stable key, goes to a human.

Failure modes and how you see them

  • Truncated snapshot → mass deprovision. Detect before acting: compare records walked against the target's reported totalResults, and refuse destructive actions if the walk didn't complete. Alarm on the ratio too: a healthy run classifies well under 0.5% of accounts as extra; a run flagging 5% is a broken snapshot, not 5% real drift.
  • Eventual consistency. Entra ID's provisioning service runs incremental cycles roughly every 40 minutes; Okta pushes near-real-time. Reconcile 30 seconds after a write against an eventually consistent target and you'll see the account missing and re-create it. Detect: duplicate externalId in the target.
  • Rate limits. Okta returns 429 with Retry-After; a naive walk treats that as end-of-list. Back off, resume from the last checkpoint, and mark the snapshot complete only when the cursor is exhausted.

Metrics

Drift age = now − first_seen_at on the drift record, not the account's creation date: that's what tells you how long a human has been wrong. Recurrence = count of drift records for the same (externalId, target) in a 30-day window. One account drifting three times in 30 days is not a remediation problem; it's a broken integration, and the fix is upstream.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-24

Operate and monitor provisioning connectors.

Answer

Core answer

Assume a SCIM 2.0 connector (RFC 7644) from an IdP, Entra ID or Okta, into a target like Slack, GitHub, or an internal app, with the HRIS as source of truth. The first thing I'd say: the connector's health is not "is it running", it's "how old is the oldest change that hasn't landed on the target". A connector that syncs 10,000 creates an hour and drops every delete is green on throughput and is a security incident.

So I'd answer with three numbers: oldest pending change age, reconciliation divergence count, and target write error rate by class.

Mechanism

Provisioning is at-least-once delivery from a source of truth to a target that is the authority on access. Creates are near-idempotent and get retried; deletes and deactivations are the ones that fail silently: a 404 on delete is often treated as success, and a PATCH the target ignores returns 200. That asymmetry is why "oldest leaver" is the metric, not "events processed".

Backlog age matters because it's the window in which a terminated employee still has a live session. Depth alone lies: 5,000 queued events draining in 30 seconds is fine; 3 queued for 6 hours is not.

Divergence arises because the connector only knows what the source told it. If a target admin re-adds a user by hand, or a group membership is edited in the target, the next incremental sync won't correct it: incremental syncs carry deltas, not state. Only a full reconciliation scan compares the whole target against the source.

Poison records: one user with a malformed attribute (a null userName, an email the target rejects) fails validation on every attempt. If the connector processes a batch in order and retries the batch head, that one record blocks everything behind it: head-of-line blocking. Detection is a retry count per record, not per batch.

Signals and example thresholds

signalexample alertwhy
oldest pending change> 15 min warn, > 60 min pageleaver window
oldest pending deactivation> 5 min pageaccess still live
target 429 ratesustained > 5% of callsthrottling, will back up
per-record retries> 3poison record
reconciliation divergenceany unexpecteddrift
cert/token expiry< 14 daysauth outage

Worked trace

HRIS fires termination at 09:00 → IdP marks user inactive → SCIM PATCH /Users/{id} {"active": false} at 09:02 → target returns 429 → connector backs off, retries at 09:32 → succeeds. Oldest-deactivation-age peaked at 30 min. If instead the target returned 200 but ignored active, the connector records success and the account stays live until the nightly reconciliation scan flags it, which is why you read the target back, not the connector's own log.

Trade-offs

Alert by consequence (a leaver not deactivated) beats alerting per component, because component alerts fire on things that don't matter and miss the ones that do. But consequence alerting needs the reconciliation scan to be trustworthy, so you run it more often than you'd like: the cost is target API load. Full reconciliation every hour is expensive against a rate-limited target; nightly is usually the compromise, with the oldest-deactivation-age alert covering the gap. Hard delete vs deactivate: deactivate is reversible and auditable, hard delete is not. Default to deactivate unless a regulation requires erasure. Per-tenant isolation is right when one tenant's poison record can block another's queue; it's wrong when it multiplies your credential and cert rotation surface for no benefit.

Failure modes and detection

  • Target outage: writes queue, oldest-age climbs; detect via target 5xx rate and queue age, not connector "up".
  • Throttling: 429s, backoff grows; detect via 429 ratio and effective throughput drop.
  • Invalid schema: per-record retry count, head-of-line blocking; detect via retry histogram.
  • Partial recovery: some tenants caught up, others not; detect via per-tenant oldest-age, not global.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-17

Coordinate deprovisioning with session and token revocation.

Answer

Assumptions: an OIDC IdP (Okta, Entra ID, Keycloak) is the source of truth; RPs validate self-contained JWTs locally; access-token TTL 15 min, refresh-token TTL 12 h; AWS IAM Identity Center for cloud.

Deprovisioning is one event in the IdP. Enforcement is N independent channels that don't share a clock. The coordination job is to classify every credential by whether it has a live revocation channel, drive the ones that do, and bound the ones that don't by lifetime, then prove the bound held.

Why tokens outlive revocation. A self-contained JWT access token is validated by the RP's signature check, with no call back to the IdP. Revoking it at the IdP changes nothing the RP can see; it stays valid until exp. Refresh tokens are different: they're stateful at the IdP, so RFC 7009 revocation actually kills them. Browser sessions are different again: the RP owns the cookie, so only OIDC Back-Channel Logout reaches it. The residual window after deprovision is therefore the longest-lived credential with no working revocation channel: usually the access-token TTL or a cloud role session.

Sequence. t0: the IdP sets the account inactive, which stops new issuance. t0+seconds: the IdP POSTs a logout token to each RP's backchannel_logout_uri; the RP returns 200 and destroys the session. Same window: call the RFC 7009 revocation endpoint for every refresh token. Then remove the IAM Identity Center permission-set assignment. The access token issued at t0−1s still works until its exp: that's the accepted window, and it's why you keep it at 5–15 min.

SurfaceRevocation channelResidual window if channel fails
Access token (JWT)none: local validation= exp (5–15 min)
Refresh tokenRFC 7009 endpointrefresh TTL (12 h)
RP browser sessionOIDC Back-Channel Logoutcookie TTL
Downstream SaaSSCIM PATCH active=falseapp's own session TTL
AWS role sessionremove permission-set assignmentup to 12 h
SSH key / DB passwordmanual rotationindefinite

Trade-offs. Short access-token TTL is the cheap lever: no per-request call, but users re-authenticate more often and the IdP's token endpoint takes more load. Token introspection (RFC 7662) gives near-immediate revocation at the cost of a network round trip per request and makes the IdP a hard availability dependency: cache it 30–60 s and you've reintroduced a window anyway. Back-channel logout is the right tool for browser sessions but only works where the RP registered an endpoint; front-channel logout depends on the browser being open. Use introspection only for high-value APIs where a 15-minute stale token is unacceptable.

Failure modes.

  • RP never registered backchannel_logout_uri, or the endpoint 500s. The session survives to cookie expiry. Detect: log logout-token delivery per RP, alert on non-200; test with a real logout during onboarding.
  • SCIM sets active=false but the app keeps its own session cookie. Detect: post-deprovision browser login attempt against the app, not the IdP.
  • A cloud role session can't be killed mid-flight: removing the assignment blocks new sessions, not the live one. Detect: aws sts get-caller-identity with the old session credentials.
  • Local credentials (SSH keys, service-account passwords) aren't in the IdP at all. Detect: inventory diff between IdP accounts and host/DB accounts.

Verification. Instrument each surface to emit a 401/403 tagged with the token subject, and compute deactivation timestamp → first denial per surface. Target p95 ≤ access-token TTL + 60 s propagation. A surface that never emits a denial is untested, not clean.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-19

Handle resource ownership and automation during offboarding.

Answer

Clarify first (the first 30 seconds)

Two questions decide the order of everything: is this a voluntary departure with notice, or an immediate termination, and does any automation authenticate as this human in a way that can't be rotated without a maintenance window? I'll assume a voluntary departure with two weeks' notice, a human identity in Entra ID or Okta, and automation spread across a CI/CD platform, one cloud account, and a handful of SaaS schedulers.

Core answer

Split it into two problems with different clocks. Ownership transfer is a data problem: find everything the identity owns and give it a named human or a workload identity. Credential revocation is a security problem: anything that authenticates as that human has to stop working. For a voluntary departure, transfer first and revoke last, because revocation is what breaks the automation you haven't migrated yet. For an involuntary one, revoke first and accept the breakage.

Inventory from logs, not from memory

Ask the person for a list, then ignore it and check the logs, because the list is always short. Entra ID sign-in logs and the Azure DevOps PAT page's "last used" column, GitHub's audit log filtered by actor, CloudTrail events where userIdentity is the departing principal, and the on-call schedules in PagerDuty or Opsgenie. The gap between the two lists is the finding.

What to replace, and with what

CredentialLifetime if left aloneReplace with
GitHub classic PATCan be set to never expireGitHub App installation token, 1 hour, auto-rotated
AWS IAM user access keyNo expiry by defaultIAM role assumed via OIDC from the CI platform
AWS STS session1 hour default, up to 12 hours if configured on the roleunchanged
Entra ID refresh token90 days max inactive time by defaultn/a: revoke explicitly
Kubernetes bound SA token1 hour via TokenRequestunchanged
Azure DevOps PATUp to 1 yearWorkload identity federation service connection

The point of the table is that disabling the account does not revoke the tokens. An IAM access key created by the departing engineer keeps working after their SSO account is disabled, because IAM users don't federate.

Trade-off: transfer or recreate

Transferring a repository or pipeline preserves its history, its createdBy metadata and its audit trail, but carries the old identity's permission grants with it. Recreating under a workload identity gives you a clean permission set and no personal principal, but you lose the history and have to re-validate the pipeline end to end. For anything touching production I recreate; for dashboards and documentation I transfer.

Failure mode and how you catch it

A nightly job runs as an IAM user whose access key was pasted into a Jenkins credential by the departing engineer. Day 0: their SSO account is disabled. The job is unaffected. Months pass. Detection is a CloudTrail query for userIdentity.userName values with no matching federated principal, plus the IAM credential report filtered to keys older than 90 days. The cost is not the outage; it's that the job has been running with permissions nobody has reviewed since the person left.

For ownerless schedules, disable rather than delete: you can re-enable in one click when someone claims it, and deleting loses the definition.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-20

Design controlled manual provisioning and exception handling.

Answer

What I'd say in the first 90 seconds

Assume the IdP (Okta or Entra ID) is the source of truth and targets are reached through SCIM or cloud IAM APIs. "Manual provisioning" means a grant the normal request → approval → provision pipeline can't express: a connector is down, the entitlement isn't in the catalog, or it's an incident. My answer is: don't edit the target. Write a time-bound exception object into the IdP, let reconciliation derive effective access from baseline ∪ active exceptions, and let expiry remove it.

The exception record

fieldexamplewhy
subjectalice@corpwho gets access
entitlementaws:prod-account / role / DBReadOnlytarget + scope; must be a modeled entitlement
operatorbob@corp (on-call IAM)who executes; must ≠ subject
approvercarol@corp (risk)required for high-impact entitlements
justificationINC-4821incident or ticket ID
created_at / expires_at14:02 / 18:02 UTCbounded window
max_duration4 h; 1 h for prod adminhard cap per entitlement class
statusactive → expired → revokedlifecycle

Why desired-state separation matters

If you edit the target directly, the next SCIM sync or Terraform apply either reverts it (drift) or adopts it as baseline: the exception becomes permanent and invisible. So the exception lives in an overlay, not in connector state. Effective access = baseline ∪ {exceptions where now < expires_at}. The reconciler runs every 5 minutes: it computes that set, diffs it against the target, and applies the delta. When expires_at passes, the entry drops out of the set and the next run revokes the access.

Execution

The operator authenticates with MFA, assumes a short-lived role (AWS STS AssumeRole, DurationSeconds ≤ 43200 s = 12 h max), and applies the grant through the same API the automated path uses, so it lands in the same audit stream. Entra PIM does this natively: an eligible assignment, activated with justification and approval, that auto-expires.

Trade-offs

  • Direct target edit: fastest, no audit trail, drifts or becomes permanent. Never for anything with a blast radius.
  • Ticket plus human execution: auditable, but slow (minutes to hours) and error-prone. Fine for genuine one-offs.
  • Exception object with auto-expiry: auditable and bounded, but only works if the entitlement is modeled. That's the cost.

Use manual when the automated path is unavailable or the entitlement isn't modeled. Don't use it for routine access: if the same entitlement is granted manually again and again, that's a missing automated path, not a process.

Failure modes

  • Self-grant (operator == subject): reject at write time; alert on any such record. Cost: blocks the sole admin during break-glass. Pair with a second on-call approver.
  • Expiry not enforced because the reconciler is down: access outlives its window. Detect with an alert if the reconciler hasn't completed in more than 2× its interval, plus a daily report of active exceptions past expires_at.
  • Exception adopted as baseline: someone edits the target directly and sync keeps it. Detect with a drift report: any entitlement present in the target but not in baseline ∪ exceptions.
  • Repeated exceptions: the same entitlement granted more than 3 times in 30 days → file to model it in the catalog.

Emergency path

Break-glass account, credentials in a sealed vault, two-person approval, session recorded, rotated after use, tested quarterly.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-25

How do you automate access recertification campaigns and reconcile revoked entitlements across downstream target systems?

Answer

The 90-second version

Assume the governance platform is authoritative for who should hold what, targets are a mix of SCIM 2.0 apps and a few non-API legacy systems, and at least one target issues stateless JWTs. Recertification isn't the campaign UI; it's the loop that runs after a reviewer clicks revoke:

  1. The campaign engine writes an immutable decision event per entitlement.
  2. A connector applies an idempotent mutation to the target.
  3. The orchestrator kills live sessions and refresh tokens: removing group membership does not invalidate an already-minted JWT.
  4. A read-back confirms the target reflects the decision.
  5. A recurring reconciliation diffs target state against the governance DB and re-revokes anything that came back.

Interviewers push on two things: idempotency and ordering in step 2, and drift. Out-of-band grants that make a revoked entitlement live again.

Decision event → idempotent mutation

Event: EntitlementRevocationRequested{subjectId, targetAppId, entitlementId, reviewerId, decidedAt}, with an idempotency key of hash(subjectId, targetAppId, entitlementId, campaignId). Replays are no-ops.

SCIM 2.0 target, per RFC 7644 §3.5.2:

HTTP
PATCH /v2/Groups/2819c223-7f76-453a-919d-413861904646 HTTP/1.1
Host: scim.target.example.com
Content-Type: application/scim+json
Authorization: Bearer <token>

{
  "schemas": ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
  "Operations": [{
    "op": "remove",
    "path": "members[value eq \"a1b2c3d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d\"]"
  }]
}

A remove whose path matches nothing is a no-op returning 200/204, so retries are safe. The failure that bites: if the target models the entitlement as a role assignment rather than group membership, the PATCH returns 200 and access persists. That's why step 4 exists.

Session invalidation

Group removal leaves already-issued tokens valid. For OIDC RPs, send a Back-Channel Logout logout_token (OpenID Connect Back-Channel Logout 1.0); for OAuth 2.0 refresh tokens, POST to the revocation endpoint (RFC 7009). Targets with cookie-only sessions need the IdP session killed plus a short access-token TTL: at a 15-minute TTL, worst-case residual access is 15 minutes, and that's the number to write into the risk acceptance.

Reconciliation and drift

Runs daily and once immediately after campaign close.

PhaseWhat runsFailure it catchesResponse
IngestGET /v2/Groups?filter=displayName eq "DevOps-Admin"target rate-limits or paginates inconsistentlycursor pagination, backoff with jitter on 429
Diffcompare members against governance DBentitlement present on target but revoked in campaignauto re-revoke + security alert
Verifyread back the resource after PATCH200 on PATCH but access persists (role model, cache)quarantine connector, page app owner

Worked trace

Campaign closes with 4,120 revocations across three targets. Connector results: 4,096 PATCHes returned 200/204; 18 returned 429 and went to the DLQ; 6 were non-API targets and became tickets. Read-back of the 4,096 that reported success, 30 minutes later: 4,095 entitlements gone, 1 still present. The target's audit log shows actor svc-deploy re-granted it at 14:02, 40 minutes after the PATCH. That one gets an immediate re-revoke and a security alert; the 18 DLQ items and 6 tickets stay queued.

Failure handling

  • Target unreachable or rate-limited: exponential backoff with jitter, DLQ after 5 attempts over 1 hour.
  • Revocation SLA breach (say 2 hours): suspend the identity at the IdP. That cuts authentication to every downstream target at once, which is faster than chasing individual connectors.
  • Non-API targets: ticket with dual-engineer sign-off and target evidence; entitlement stays "Provisioning Pending" until an authoritative snapshot reconciles it.

Cadence itself is a policy choice: SP 800-53 Rev 5 AC-2(j) requires reviewing accounts for compliance at an organization-defined frequency, so quarterly is a common default, not a spec.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-22

Design lifecycle audit and evidence.

Answer

What I'd say first

I'd design this as an append-only, event-sourced audit log written by the provisioning pipeline itself: one record per state transition, hash-chained, stored on WORM media. Reconstructing history from target APIs after the fact doesn't work: targets overwrite state, and a deprovisioned account is usually deleted, taking its evidence with it.

Assumptions I'd state: the IdP (Okta, Entra ID) is the source of truth; targets are downstream (AD, AWS IAM, Salesforce, SaaS via SCIM 2.0, RFC 7643/7644); the compliance driver is SOC 2 change-management and monitoring criteria plus SOX, so retention is 1–7 years.

The record

One row per transition, not per request. Fields and why each earns its place:

fieldwhy it's there
event_id, correlation_idcorrelation_id ties the source event, policy decision, every connector call and the reconciliation pass into one reconstructable chain
event_time vs effective_timeevent_time is when we observed it; effective_time is when it takes effect (a termination at 23:59). Point-in-time queries: "what did X have on 2025-03-14?": need effective_time
subject_idstable, opaque identity key; never the email, which changes on rename
actorhuman or system that triggered it; "system" alone is useless in an incident
before/after (normalized)attribute names plus changed values, not the whole object
policy_version, desired_state_diffproves the decision was made under a known rule set
target, target_resource_id, target_versionwhich system, which object, at which version
result, error, retry_countsuccess/failure and the retry trail
reconciliation_outcomewhether a later full-state read confirmed it

How it behaves

The pipeline emits the source event, the policy evaluation, each connector call, and the target result under one correlation_id. Reconciliation closes the loop: a nightly full-state read per target, diffed against desired state, emitting drift events. Without it, a connector that returns 200 but doesn't apply the change leaves silent drift.

Trade-offs

Event-sourced vs snapshot: event-sourced gives point-in-time reconstruction and tamper evidence but grows unbounded and is slow to query, so you materialize a nightly snapshot per identity. Snapshot-only is cheap to query but can't prove history or explain why. If you have one target and no SOX, a structured log to a SIEM with 400-day retention is enough: don't build WORM for that.

Failure modes

  • Silent connector drift: target returns 200, change not applied. Detected by reconciliation diff count > 0. Cost: one full-state read per target per day, bounded by API rate limits.
  • Clock skew: IdP and target clocks disagree, so effective_time ordering is wrong. Store both timestamps and compare against an NTP-synced source.
  • PII leakage: logging the full before/after object leaks attributes. Log attribute names and hashed values.
  • Retention vs erasure: a GDPR Article 17 request collides with WORM retention. Crypto-shredding (per-subject key, delete the key) satisfies both.
  • Hash-chain break: a verification job recomputes the chain; a mismatch is a tamper signal.

Worked trace (hypothetical)

09:00:00Z HR emits termination, effective 2025-03-14T23:59:59Z, correlation c-8842. +200ms pipeline normalizes, evaluates policy leaver-v7, desired state = revoke all. +1.0s Okta DELETE /users/00u… → 204. +1.2s AWS IAM detach policies → 200. +1.5s Salesforce deactivate → 200. +1.6s record written, result=success. Next 03:00Z reconciliation reads full state, finds Salesforce still active (deactivation queued), emits drift event, retries.

Storage: 50k employees × ~12 transitions/year × 2 KB normalized ≈ 1.2 GB/year; 7 years ≈ 8.4 GB. Logging full objects at 20 KB would be ~84 GB: still cheap, but the PII exposure isn't.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-23

Define identity lifecycle quality and risk metrics.

Answer

Two families, and the split is the whole answer. Quality metrics ask: did the lifecycle process do what the policy says, on time, for every identity? Risk metrics ask: given what actually happened, how much access does someone still hold that they shouldn't? A process can score 100% on quality and still leak: every ticket closed, every workflow green, and a terminated contractor still in a group because that group lives in a target nobody reconciled.

Quality (did the process run?)Risk (what access remains?)
JoinTime from HR record to birthright entitlements in every targetIdentities with no birthright access after N days
MoverTime from role change to old access removed at targetStale-access duration per identity, by target criticality
LeaverTermination tickets closedTime from authoritative leave to denied access at the last target
Steady stateReconciliation job ranDrift count, and age of the oldest unresolved difference

Quality metrics, with the mechanism behind each. Join readiness: time from HR record creation to the identity holding its birthright entitlements in every target. Detects provisioning lag and birthright gaps; report p50/p95, not mean. Birthright exceptions: identities whose baseline set differs from the role's defined baseline, missing or extra. Detects role-definition drift and grants that bypassed the birthright path. Mover stale-access duration: for each entitlement removed on a role change, time from the change event to removal at the target. Detects the classic mover problem, new access granted and old access never revoked. Connector backlog and oldest event: queue depth and age of the oldest unprocessed event. A backlog of 10k events is a quality problem; an oldest event of 6 hours means every leaver revocation is 6 hours late. Poison records: events that fail repeatedly and get parked. Identities that will never provision without intervention. Manual overrides: lifecycle actions done by hand; each one marks a place the automated path failed.

Risk metrics. Sessions surviving deactivation: active sessions or tokens after the account is disabled. Disabling an account in Entra ID or Okta does not kill an already-issued OAuth refresh token or an existing SSO session, so this is a real residual-exposure number, not a formality. Orphan accounts: accounts in a target with no matching authoritative identity. Targets that were never wired to the source. Duplicate accounts: more than one account per identity in a target. Rehire and merge failures. Out-of-band grants: entitlements granted directly in the target rather than through the lifecycle system. Shadow process. Reconciliation drift and age: differences between source of truth and target, plus how long the oldest unresolved difference has existed. Count is the quality signal; age is the risk signal.

Worked check (illustrative figures). 1,000 terminations in a quarter. 940 revoked within a 4-hour SLA, 45 between 4 and 24 hours, 15 never revoked: 9 because the target had no connector (orphans), 6 because the event was parked as poison. Quality metric (workflow completion) reads 100%: every termination ticket closed. Risk metric (effective revocation within SLA) reads 94%. The 6% is the number to report, and the 15 never-revoked are the ones to escalate.

Trade-offs. Measure at the target, not the IdP. The IdP will always report the workflow completed; only the target can report that access is gone. Target-side measurement costs a reconciliation job per target and lags reality. Sampling reconciles cheaply but misses the long tail where the risk lives; full reconciliation is expensive but is the only way to catch orphans. Segment by target and identity type, or a low-risk wiki and a production AWS account average into a comfortable number.

Failure modes. Counting workflow completion as revocation: the workflow closes when the message is sent, not when the target confirms. Reporting the mean instead of p95: one 30-day orphan disappears in the average. Treating a green reconciliation job as clean when it only compared counts, not entitlement sets.

Curated: · Written: · Reviewed:

Difficulty: Hard
Q&A-21

Protect lifecycle state during disaster recovery.

Answer

What I'd say in the first two minutes

"Lifecycle state" is the set of identity facts that decide who can do what: accounts, group memberships, role assignments, credentials (passwords, MFA factors, API keys), live sessions, and the provisioning state that records which downstream app holds which user. The trap in disaster recovery is that a backup is a point-in-time truth and identity truth keeps moving. Restore it verbatim and you resurrect leavers and re-grant access that was revoked after the snapshot was taken.

Assumptions I'd state up front: the authoritative source of truth (HR system or IdP) survived the disaster or is reachable; the identity backup has an RPO around 15 minutes and the restore RTO is around 4 hours; downstream apps are provisioned by SCIM on a 40-minute sync. If the source of truth is also gone, the answer changes: I'll come back to that.

My answer: restore the directory data, then reconcile against the current authoritative source before re-enabling sign-in, and treat every credential and session inside the backup as compromised.

Why replay beats a snapshot restore

A snapshot restore writes back the exact rows that existed at backup time. Replay takes the current desired state (the HR feed, the group rules) and computes the delta. The difference matters because offboarding is a deletion in the source of truth, and a snapshot has no way to know a deletion happened after it was taken. Reconciliation detects drift by diffing the restored set against the source: accounts present in the backup but absent from HR are leavers to disable; grants present in the backup but absent from current policy are revoked.

ApproachCostDeciding criterion
Snapshot restore as-isFastest RTO, but resurrects leavers and revoked grantsOnly if the source of truth is unreachable
Full replay from sourceCorrect, but RTO bounded by source availability and sync lagSource of truth survived
Restore then reconcile (hybrid)~15 min extra before sign-in opensDefault when source is reachable

Failure modes and how I'd detect them

  • Resurrected leaver accounts. Detect: reconcile diff reports any account in the backup that is not in the HR feed; block sign-in until that count is zero.
  • Reverted MFA enrollment. Detect: count users with no enrolled factor after restore; if greater than zero, force re-enrollment before access.
  • Stale OAuth refresh tokens. A backup can carry refresh tokens with a 30-day TTL. Detect: introspect against the pre-disaster token store and revoke everything issued before the incident.
  • Audit gap. Detect: a sequence gap in SIEM ingest; backfill from the IdP system log so the recovery window is not a blind spot.

What would change the decision

If the authoritative source of truth is also lost, replay is impossible. Then I restore the snapshot but force a global credential reset and MFA re-enrollment, accept a longer RTO, and reconcile against HR once it returns. The deciding question is always whether current desired state is reachable: that, not the backup's age, is what tells you whether you can replay or must reset.

Curated: · Written: · Reviewed:

Difficulty: Hard