Skip to content

CLI reference

Every warden command with its usage, flags and examples, generated from the oclif command metadata.

sf warden access

Audit active-user access for a permission target.

Usage

Terminal window
sf warden access [--json] [--flags-dir <value>] [-o <value>] [--type field|object|apex-class|vf-page|custom-permission|tab|record-type] [--target <value>] [--user <value>] [--sobject <value>] [--output human|csv|json] [--output-file <value>] [--api-version <value>] [-i]

Flags

-i, --interactive

Prompt for missing command values, summarize them, and confirm before continuing.

-o, --target-org <value>

Target org username or alias.

--api-version <value>

Salesforce API version to use, for example 62.0.

Override the api version used for api requests made by this command

--output <option>

Output format: human, csv, or json.

Options: human · csv · json · Default: human

--output-file <value>

Write the machine-readable output payload to this path.

--sobject <value>

In reverse user mode, report field or object access scoped to this SObject.

--target <value>

Target API name. Use Object.Field for field, Object for object, Apex class name for apex-class, Visualforce page name for vf-page, custom permission DeveloperName for custom-permission, tab API name for tab, or SObject.DeveloperName for an active non-master record type.

--type <option>

Target type to audit: field, object, apex-class, vf-page, custom-permission, tab, or record-type.

Options: field · object · apex-class · vf-page · custom-permission · tab · record-type

--user <value>

Reverse audit for one user, using field:value matching (for example Username:alice@example.com).

Global flags

--flags-dir <value>

Import flag values from a directory.

--json

Format output as json.

Description

Resolves active users who have access to a target and attributes each access path to Profile, Permission Set, or Permission Set Group sources.

Examples

Field access in human output (default):

Terminal window
sf warden access --type field --target Account.CustomField__c --target-org myOrg

Object access in csv output:

Terminal window
sf warden access --type object --target Account --target-org myOrg --output csv

Field access in json output:

Terminal window
sf warden access --type field --target Account.CustomField__c --target-org myOrg --output json

Apex class access in human output:

Terminal window
sf warden access --type apex-class --target MyController --target-org myOrg

Visualforce page access in csv output:

Terminal window
sf warden access --type vf-page --target MyPage --target-org myOrg --output csv

Custom permission access in json output:

Terminal window
sf warden access --type custom-permission --target Can_Edit_Accounts --target-org myOrg --output json

Tab visibility in human output:

Terminal window
sf warden access --type tab --target Account --target-org myOrg

Record type access in human output:

Terminal window
sf warden access --type record-type --target Account.Business_Account --target-org myOrg

Reverse field access for one user:

Terminal window
sf warden access --user 'Username:alice@example.com' --type field --target Account.CustomField__c --target-org myOrg

Reverse object access across an SObject:

Terminal window
sf warden access --user 'Username:alice@example.com' --type object --sobject Account --target-org myOrg --output json

Reverse record type access for one user:

Terminal window
sf warden access --user 'Username:alice@example.com' --type record-type --target Account.Business_Account --target-org myOrg

See code: src/commands/warden/access.ts

sf warden diff

Compare users against an intended definition or another user.

Usage

Terminal window
sf warden diff [--json] [--flags-dir <value>] [-o <value>] [--user <value>] [--against <value>] [--users-def <value>] [--personas-def <value>] [--external-id <value>] [--input-format json|csv] [--csv-list-delimiter <value>] [--output human|csv|json] [--output-file <value>] [--verbose] [--fail-on-drift] [--verify] [--api-version <value>] [-i]

Flags

-i, --interactive

Prompt for missing command values, summarize them, and confirm before continuing.

-o, --target-org <value>

Target org username or alias.

--against <value>

Reference user to compare against using field:value.

--api-version <value>

Salesforce API version to use, for example 62.0.

Override the api version used for api requests made by this command

--csv-list-delimiter <value>

Delimiter for multi-value CSV cells such as personas. Defaults to semicolon.

--external-id <value>

Default User field used to match entries in --users-def.

--fail-on-drift

Exit with code 1 when any user has access drift.

--input-format <option>

Override users-def format detection: json or csv.

Options: json · csv

--output <option>

Output format: human, csv, or json.

Options: human · csv · json · Default: human

--output-file <value>

Write the machine-readable output payload to this path.

--personas-def <value>

Optional path to persona definition JSON file. Omit it for profile-only diffing.

--user <value>

Target user to compare using field:value.

--users-def <value>

Path to a user definition JSON or CSV file.

--verbose

Include assignments that are already present in both sides in human output.

--verify

Check whether users conform to their intended definition.

Global flags

--flags-dir <value>

Import flag values from a directory.

--json

Format output as json.

Description

Reports read-only drift across profile, role, permission sets, permission set groups, public groups, and queues without applying changes.

Examples

Compare users in a definition file against their personas:

Terminal window
sf warden diff --users-def config/user-def.json --personas-def config/persona-def.json --external-id FederationIdentifier --target-org myOrg

Compare one user against another:

Terminal window
sf warden diff --user username:new@example.com --against username:template@example.com --target-org myOrg --output csv

See code: src/commands/warden/diff.ts

sf warden freeze

Freeze one or more users.

Usage

Terminal window
sf warden freeze [--json] [--flags-dir <value>] [-o <value>] [--user <value>] [--users-def <value>] [--external-id <value>] [--input-format json|csv] [--csv-list-delimiter <value>] [--output human|csv|json] [--output-file <value>] [--no-prompt] [--dry-run] [--api-version <value>] [-i]

Flags

-i, --interactive

Prompt for missing command values, summarize them, and confirm before continuing.

-o, --target-org <value>

Target org username or alias.

--api-version <value>

Salesforce API version to use, for example 62.0.

Override the api version used for api requests made by this command

--csv-list-delimiter <value>

Delimiter for multi-value CSV cells such as personas. Defaults to semicolon.

--dry-run

Validate and plan actions without any write operations.

--external-id <value>

Default User field used to match entries in --users-def.

--input-format <option>

Override users-def format detection: json or csv.

Options: json · csv

--no-prompt

Skip confirmation prompts before write operations.

--output <option>

Output format: human, csv, or json.

Options: human · csv · json · Default: human

--output-file <value>

Write the machine-readable output payload to this path.

--user <value>

Target a single user using field:value.

--users-def <value>

Path to a user definition JSON or CSV file.

Global flags

--flags-dir <value>

Import flag values from a directory.

--json

Format output as json.

Description

Freezes matching users by setting UserLogin.IsFrozen = true and leaving all other access untouched.

Examples

Preview a single freeze by field match:

Terminal window
sf warden freeze --user username:someone@example.com --dry-run --target-org myOrg

Freeze users from a definition file without prompts:

Terminal window
sf warden freeze --users-def config/user-def.json --external-id FederationIdentifier --target-org myOrg --no-prompt

See code: src/commands/warden/freeze.ts

sf warden persona diff

Compare a persona definitions file with org-defined personas.

Usage

Terminal window
sf warden persona diff --input <value> [--json] [--flags-dir <value>] [-o <value>] [--api-version <value>]

Flags

-o, --target-org <value>

Target org username or alias.

--api-version <value>

Salesforce API version to use, for example 62.0.

Override the api version used for api requests made by this command

--input <value> · required

Persona definitions JSON file.

Global flags

--flags-dir <value>

Import flag values from a directory.

--json

Format output as json.

Description

Reports added, removed, and changed personas without writing to the org.

See code: src/commands/warden/persona/diff.ts

sf warden persona export

Export org-defined Warden personas to a JSON file.

Usage

Terminal window
sf warden persona export --output <value> [--json] [--flags-dir <value>] [-o <value>] [--api-version <value>]

Flags

-o, --target-org <value>

Target org username or alias.

--api-version <value>

Salesforce API version to use, for example 62.0.

Override the api version used for api requests made by this command

--output <value> · required

Destination personas.json file.

Global flags

--flags-dir <value>

Import flag values from a directory.

--json

Format output as json.

Description

Reads active wdn_Persona__c records and their components and writes the canonical personas.json format.

See code: src/commands/warden/persona/export.ts

sf warden persona import

Import persona definitions into the connected org.

Usage

Terminal window
sf warden persona import --input <value> [--json] [--flags-dir <value>] [-o <value>] [--prune] [--dry-run] [--api-version <value>]

Flags

-o, --target-org <value>

Target org username or alias.

--api-version <value>

Salesforce API version to use, for example 62.0.

Override the api version used for api requests made by this command

--dry-run

Validate and plan actions without any write operations.

--input <value> · required

Persona definitions JSON file.

--prune

Delete org components that are absent from the input file.

Global flags

--flags-dir <value>

Import flag values from a directory.

--json

Format output as json.

Description

Upserts personas by wdn_Api_Name__c and adds missing components. Use —prune to remove components absent from the input file, and —dry-run to see the changes without writing them.

See code: src/commands/warden/persona/import.ts

sf warden provision

Provision users from user and persona definition files.

Usage

Terminal window
sf warden provision [--json] [--flags-dir <value>] [-o <value>] [--users-def <value>] [--personas-def <value>] [--persona-source file|org] [--related-def <value>] [--external-id <value>] [--input-format json|csv] [--csv-list-delimiter <value>] [--fuzzy-username] [--no-prompt] [--dry-run] [--cleanup-on-failure] [--fail-on-insufficient-license] [--log-to-org] [--log-detail summary|full] [--output human|csv|json] [--output-file <value>] [--api-version <value>] [-i]

Flags

-i, --interactive

Prompt for missing command values, summarize them, and confirm before continuing.

-o, --target-org <value>

Target org username or alias.

--api-version <value>

Salesforce API version to use, for example 62.0.

Override the api version used for api requests made by this command

--cleanup-on-failure

Delete related records created in this run for failed users, where safe.

Opt in to best-effort cleanup after provisioning fails. Deletes only related records created for that user in this run, in reverse phase order. Keeps matched or updated records and before records linked to a successfully saved User. Never deletes or reverts the User. Has no effect with —dry-run.

--csv-list-delimiter <value>

Delimiter for multi-value CSV cells such as personas. Defaults to semicolon.

--dry-run

Validate and plan actions without any write operations.

--external-id <value>

Filterable User field used to match existing users by default. --match-field is an alias. Per-user match overrides this for individual rows. If omitted, all entries are treated as inserts. Multiple matches are skipped.

--fail-on-insufficient-license

Fail after dry-run output when projected net-new users exceed user-license headroom.

--fuzzy-username

Match Username values with optional Salesforce sandbox suffixes.

--input-format <option>

Override users-def format detection: json or csv.

Options: json · csv

--log-detail <option>

Connected audit detail level: summary writes the Run header; full also writes one Item per provision output row.

Options: summary · full · Default: summary

--[no-]log-to-org

Write connected Warden ledger and optional reconciliation audit records when the package is installed.

--no-prompt

Skip warning confirmation prompts.

--output <option>

Output format: human, csv, or json.

Options: human · csv · json · Default: human

--output-file <value>

Write the machine-readable output payload to this path.

--persona-source <option>

Persona definition source: file or org. Defaults to file when —personas-def is supplied, otherwise org when warden-base is installed in the org.

Options: file · org

--personas-def <value>

Optional path to persona definition JSON file. Omit it for profile-only provisioning.

Optional path to a related-record definition JSON file. Declares named relationships a user entry selects with a related array. Supports phase: "before" and "after", before-phase User linking, and per-user context sources; requires a JSON --users-def.

--users-def <value>

Path to a user definition JSON or CSV file.

Global flags

--flags-dir <value>

Import flag values from a directory.

--json

Format output as json.

Description

Provisions Salesforce users by merging multiple personas per user into an effective persona (unioning assignment lists, enforcing singular-value agreement), applying insert-only Username and Alias defaults, enforcing optional profile and role, activating and unfreezing users, and planning or applying assignment changes. --personas-def is optional for profile-only provisioning.

Matching accepts any filterable User field. A match with more than one result is skipped. Use --fuzzy-username for sandbox username suffixes, or set fuzzyUsername: true on an individual user; the per-user value overrides the global flag.

Examples

Dry run with explicit external id:

Terminal window
sf warden provision --users-def config/user-def.json --personas-def config/persona-def.json --external-id FederationIdentifier --target-org myOrg --dry-run

Dry run matching by another filterable User field:

Terminal window
sf warden provision --users-def config/user-def.json --personas-def config/persona-def.json --match-field LastName --target-org myOrg --dry-run

Apply provisioning with no prompt:

Terminal window
sf warden provision --users-def config/user-def.json --personas-def config/persona-def.json --target-org myOrg --no-prompt

Match production usernames to sandbox-suffixed users:

Terminal window
sf warden provision --users-def config/user-def.json --personas-def config/persona-def.json --fuzzy-username --target-org mySandbox --dry-run

See code: src/commands/warden/provision.ts

sf warden restore

Restore user assignment state from a snapshot file.

Usage

Terminal window
sf warden restore [--json] [--flags-dir <value>] [-o <value>] [--snapshot <value>] [--output human|csv|json] [--output-file <value>] [--no-prompt] [--dry-run] [--api-version <value>] [-i]

Flags

-i, --interactive

Prompt for missing command values, summarize them, and confirm before continuing.

-o, --target-org <value>

Target org username or alias.

--api-version <value>

Salesforce API version to use, for example 62.0.

Override the api version used for api requests made by this command

--dry-run

Validate and plan actions without any write operations.

--no-prompt

Skip confirmation prompts before write operations.

--output <option>

Output format: human, csv, or json.

Options: human · csv · json · Default: human

--output-file <value>

Write the machine-readable output payload to this path.

--snapshot <value>

Path to a user snapshot JSON or CSV file.

Global flags

--flags-dir <value>

Import flag values from a directory.

--json

Format output as json.

Description

Re-resolves users by the snapshot match key, reactivates and unfreezes them, and adds missing assignments without removing existing access.

Examples

Preview a restore:

Terminal window
sf warden restore --snapshot snapshots/user.json --dry-run --target-org myOrg

Restore without prompts:

Terminal window
sf warden restore --snapshot snapshots/user.json --target-org myOrg --no-prompt

See code: src/commands/warden/restore.ts

sf warden snapshot

Capture user assignment state to a portable snapshot file.

Usage

Terminal window
sf warden snapshot [--json] [--flags-dir <value>] [-o <value>] [--user <value>] [--users-def <value>] [--external-id <value>] [--input-format json|csv] [--csv-list-delimiter <value>] [--output human|csv|json] [--output-file <value>] [--out <value>] [--api-version <value>] [-i]

Flags

-i, --interactive

Prompt for missing command values, summarize them, and confirm before continuing.

-o, --target-org <value>

Target org username or alias.

--api-version <value>

Salesforce API version to use, for example 62.0.

Override the api version used for api requests made by this command

--csv-list-delimiter <value>

Delimiter for multi-value CSV cells such as personas. Defaults to semicolon.

--external-id <value>

Default User field used to match entries in --users-def.

--input-format <option>

Override users-def format detection: json or csv.

Options: json · csv

--out <value>

Path to write the snapshot JSON or CSV file. The extension selects the format.

--output <option>

Output format: human, csv, or json.

Options: human · csv · json · Default: human

--output-file <value>

Write the machine-readable output payload to this path.

--user <value>

Target a single user using field:value.

--users-def <value>

Path to a user definition JSON or CSV file.

Global flags

--flags-dir <value>

Import flag values from a directory.

--json

Format output as json.

Description

Captures matching users’ active/frozen state and access assignments using developer/API names so the snapshot can be restored later.

Examples

Snapshot a single user:

Terminal window
sf warden snapshot --user username:someone@example.com --out snapshots/user.json --target-org myOrg

Snapshot users from a definition file:

Terminal window
sf warden snapshot --users-def config/user-def.json --external-id FederationIdentifier --out snapshots/users.json --target-org myOrg

See code: src/commands/warden/snapshot.ts

sf warden strip

Strip users completely, or remove selected persona access.

Usage

Terminal window
sf warden strip [--json] [--flags-dir <value>] [-o <value>] [--user <value>] [--users-def <value>] [--external-id <value>] [--input-format json|csv] [--csv-list-delimiter <value>] [--no-prompt] [--dry-run] [--no-freeze] [--no-deactivate] [--persona <value>...] [--all-personas] [--personas-def <value>] [--persona-source file|org] [--freeze] [--deactivate] [--keep-permsets] [--keep-permset-groups] [--keep-licenses] [--keep-public-groups] [--keep-queues] [--snapshot <value>] [--output human|csv|json] [--output-file <value>] [--api-version <value>] [-i]

Flags

-i, --interactive

Prompt for missing command values, summarize them, and confirm before continuing.

-o, --target-org <value>

Target org username or alias.

--all-personas

Remove access granted by every active persona held by each user.

--api-version <value>

Salesforce API version to use, for example 62.0.

Override the api version used for api requests made by this command

--csv-list-delimiter <value>

Delimiter for multi-value CSV cells such as personas. Defaults to semicolon.

--deactivate

Deactivate users in persona mode after planning access removal.

--dry-run

Validate and plan actions without any write operations.

--external-id <value>

Default User field used to match entries in --users-def.

--freeze

Freeze users in persona mode after planning access removal.

--input-format <option>

Override users-def format detection: json or csv.

Options: json · csv

--keep-licenses

Keep permission set license assignments.

--keep-permset-groups

Keep permission set group assignments.

--keep-permsets

Keep permission set assignments.

--keep-public-groups

Keep public group memberships.

--keep-queues

Keep queue memberships.

--no-deactivate

Skip the final deactivation step.

--no-freeze

Skip the initial freeze step.

--no-prompt

Skip confirmation prompts before write operations.

--output <option>

Output format: human, csv, or json.

Options: human · csv · json · Default: human

--output-file <value>

Write the machine-readable output payload to this path.

--persona <value>...

Persona API name to remove. Repeat for multiple personas.

--persona-source <option>

Read persona definitions and held personas from a file or from warden-base in the org.

Options: file · org

--personas-def <value>

Path to the persona definitions JSON file when using --persona-source file.

--snapshot <value>

Write a portable user snapshot JSON or CSV file before stripping access, including during dry-run. The extension selects the format.

--user <value>

Target a single user using field:value.

--users-def <value>

Path to a user definition JSON or CSV file.

Global flags

--flags-dir <value>

Import flag values from a directory.

--json

Format output as json.

Description

Without persona flags, freezes matching users, removes access grants, and deactivates the user unless the corresponding opt-out flags are set.

With --persona or --all-personas, removes only persona-derived access. Shared grants remain, and freeze/deactivation are off unless --freeze or --deactivate is supplied.

Examples

Preview a strip for a single user:

Terminal window
sf warden strip --user username:someone@example.com --dry-run --target-org myOrg

Strip users from a definition file without prompts:

Terminal window
sf warden strip --users-def config/user-def.json --external-id FederationIdentifier --target-org myOrg --no-prompt

Keep permission set licenses while stripping everything else:

Terminal window
sf warden strip --users-def config/user-def.json --keep-licenses --target-org myOrg --dry-run

Capture a restorable snapshot before stripping:

Terminal window
sf warden strip --user username:someone@example.com --snapshot snapshots/user.json --target-org myOrg --no-prompt

Preview removal of one persona without freezing or deactivating the user:

Terminal window
sf warden strip --user username:someone@example.com --persona support --persona-source org --dry-run --target-org myOrg

Remove every active persona and then freeze the user:

Terminal window
sf warden strip --user username:someone@example.com --all-personas --persona-source org --freeze --target-org myOrg --no-prompt

See code: src/commands/warden/strip.ts

sf warden unfreeze

Unfreeze one or more users.

Usage

Terminal window
sf warden unfreeze [--json] [--flags-dir <value>] [-o <value>] [--user <value>] [--users-def <value>] [--external-id <value>] [--input-format json|csv] [--csv-list-delimiter <value>] [--output human|csv|json] [--output-file <value>] [--no-prompt] [--dry-run] [--api-version <value>] [-i]

Flags

-i, --interactive

Prompt for missing command values, summarize them, and confirm before continuing.

-o, --target-org <value>

Target org username or alias.

--api-version <value>

Salesforce API version to use, for example 62.0.

Override the api version used for api requests made by this command

--csv-list-delimiter <value>

Delimiter for multi-value CSV cells such as personas. Defaults to semicolon.

--dry-run

Validate and plan actions without any write operations.

--external-id <value>

Default User field used to match entries in --users-def.

--input-format <option>

Override users-def format detection: json or csv.

Options: json · csv

--no-prompt

Skip confirmation prompts before write operations.

--output <option>

Output format: human, csv, or json.

Options: human · csv · json · Default: human

--output-file <value>

Write the machine-readable output payload to this path.

--user <value>

Target a single user using field:value.

--users-def <value>

Path to a user definition JSON or CSV file.

Global flags

--flags-dir <value>

Import flag values from a directory.

--json

Format output as json.

Description

Unfreezes matching users by setting UserLogin.IsFrozen = false and leaving all other access untouched.

Examples

Preview a single unfreeze by field match:

Terminal window
sf warden unfreeze --user username:someone@example.com --dry-run --target-org myOrg

Unfreeze users from a definition file without prompts:

Terminal window
sf warden unfreeze --users-def config/user-def.json --external-id FederationIdentifier --target-org myOrg --no-prompt

See code: src/commands/warden/unfreeze.ts