Getting started with Warden
Getting started with warden
warden is a Salesforce CLI plugin for user lifecycle administration: access
auditing, drift diffing, provisioning, freeze/unfreeze, and snapshot/restore.
This guide gets you from zero to your first provisioning run.
Install
sf plugins install @syntax-syllogism/warden@x.y.zOr build from source (see Contributing):
git clone https://github.com/Syntax-Syllogism/warden.gitcd wardenyarn installyarn buildnode ./bin/dev.js warden --helpConcepts
warden’s commands fall into three groups:
- Read-only audits —
accessanddiffnever write to the org. Use these to answer “who can see X” or “what’s different between this user and their intended state” before you touch anything. - State-changing lifecycle actions —
provision,freeze,unfreeze,strip, andrestoreperform DML. Every one of them supports--dry-runto preview planned changes first, and--no-promptto skip the confirmation prompt once you trust the plan (e.g. in CI). - Portable state —
snapshotcaptures a user’s active/frozen state and assignments to a JSON or CSV file; the output extension selects the format andrestoreaccepts either one. Snapshots use developer/API names when available, with Ids as a fallback, so they’re portable across orgs where the referenced names exist.
Your first provisioning run
-
Write a persona definition file describing reusable access bundles. See the persona example for a full example.
-
Write a user definition file listing the people to provision, each referencing one or more personas by name. See the user definition example.
-
Preview the plan without writing anything:
Terminal window sf warden provision --target-org myOrg \--users-def ./users.json --personas-def ./personas.json \--external-id FederationIdentifier --dry-run -
Once the plan looks right, apply it:
Terminal window sf warden provision --target-org myOrg \--users-def ./users.json --personas-def ./personas.json \--external-id FederationIdentifier --no-prompt
For the full merge/precedence rules behind provision (multiple personas per
user, assignment modes, Username/Alias defaults), see
Provisioning logic in the command
details doc.
Auditing before you change anything
Before provisioning or stripping access, it’s often useful to see current state:
# Who can see this custom field today?sf warden access --target-org myOrg --type field --target Account.CustomField__c
# How does each defined user's actual access compare to their personas?sf warden diff --target-org myOrg \ --users-def ./users.json --personas-def ./personas.jsonBoth commands are read-only and perform no writes to the org.
Snapshot before a destructive change
strip and freeze are DML operations. Capture a restorable snapshot first:
sf warden strip --target-org myOrg --user 'Username:user@example.com' \ --snapshot ./pre-strip.json --dry-run--snapshot writes the file even during --dry-run, so you can inspect the
snapshot before deciding whether to run the real strip.
Next steps
- Command details — provisioning merge logic, field precedence tables, match resolution, and assignment modes.
- Access audits — target and reverse-user access scopes, attribution, muting, and output behavior.
- Output contract — output formats, file destinations,
CSV shape, and global
--jsonbehavior. - Lifecycle output and snapshots — resolved user identity, assignment labels, snapshots, and action reporting.
- Example definitions — full
users.jsonandpersonas.jsonsamples are included in command details. - Full CLI reference: see the Commands section of
the README, or run any command with
--help.