Your joiner/mover/leaver process lives in a wiki page and three people's heads. AI can convert that prose runbook into parameterized scripts and lifecycle workflows in an afternoon — as long as you, not the model, own the approval matrix, the contractor edge cases and the rehire logic.
Tier: Core · Workflow area: Identity, endpoint & patch · ~35 minutes
This playbook takes an existing joiner/mover/leaver runbook and turns it into a parameterized PowerShell/Graph script plus an Entra lifecycle workflow (or ITSM workflow), with AI doing the drafting and you doing the two things AI reliably fumbles: deciding who approves what, and handling the humans who do not fit the happy path. (UC-30)
Extract parameters from the prose. Paste the runbook and ask:
Here is our new-starter runbook: [paste]. Extract every point where
the procedure varies by person or role, and propose a parameter table:
parameter name, type, allowed values, default, and which runbook step
consumes it. Flag any step where the runbook is ambiguous or where
two steps contradict each other. Do not write any code yet.
Expect parameters like roleTemplate, department, employmentType (FTE/contractor), startDate, manager, licensingTier, deviceType. The contradictions list is often the most valuable output — runbooks accumulate them for years.
Decide the approval matrix yourself — before any code exists. For each parameter combination, write down who approves: manager for standard access, app owner for privileged groups, HR for early-access starts, security for admin-role templates. This is policy, not scripting; a model asked to invent it will produce something plausible and unauthorized.
Have AI draft the parameterized joiner script.
Write a PowerShell function New-Starter using Microsoft Graph SDK.
Parameters: [paste your table]. Behavior:
- Create the user from a naming-convention helper (I will supply)
- Group membership comes ONLY from a role-template lookup table
defined at the top of the file — no ad-hoc group adds
- License assignment via group-based licensing, not direct
- employmentType 'Contractor' forces accountExpirationDate = end date
(mandatory parameter for contractors) and the contractor UPN suffix
- Every action writes one line to a CSV audit log: timestamp, actor,
action, target, parameters
- -WhatIf support on every mutating call
Output the role-template table as data I can review separately.
Dry-run against the last five real joiners. Run with -WhatIf using the actual parameters from your last five onboardings and diff the proposed actions against what was really done. Every mismatch is either a script bug or an undocumented runbook step — both are findings worth having before go-live.
Encode the leaver and mover flows with their sharp edges. Repeat steps 1–4 for leavers (disable, revoke sessions with Revoke-MgUserSignInSession, remove from groups, convert mailbox, set manager access — in an order you specify) and movers (the dangerous one: additive access without removal is how privilege creep happens; require the script to emit an access diff — gained and lost — for manager sign-off).
Handle rehires explicitly. Ask AI: "Given this joiner script, what breaks if the person previously existed as a user? Cover: soft-deleted objects in Entra, UPN collisions, restored mailbox contents, prior group memberships resurfacing, and stale attributes." Then encode the answer you choose — most orgs want a fresh object with a link to the old identity, not a restore — as an explicit -Rehire code path, never an accident.
Lift the happy path into Entra lifecycle workflows or your ITSM builder. Scheduled joiner tasks (enable on start date, send welcome, add to template groups) and leaver tasks (disable on last day, remove licenses after N days) move into Entra ID Governance > Lifecycle workflows; the parameterized script remains the tool for everything the workflow engine cannot express — and the two must consume the same role-template table, not two divergent copies.
employmentType, department and dates from HR-sourced attributes via inbound provisioning; lifecycle workflows trigger on employeeHireDate/employeeLeaveDateTime, and your script handles day-one exceptions.New-ADUser) with Entra Connect sync as the bridge; AI must be told sync latency exists or it will draft scripts that immediately query cloud objects that do not exist yet.JML data is HR data — start dates, departures, contractor terms and manager chains are confidential before they are announced; keep runbook drafts with real names out of public AI tools and test with synthetic users, not last week's actual leaver.
AI turns the runbook into parameters and code faster than you can, but the approval matrix, the contractor end-date rule and the rehire policy are decisions — make them explicitly, encode them visibly, and let the workflow engine automate only the path you have signed.