user Commands (Deprecated)

Commands that perform user-related admin tasks.

force:user:create (Deprecated)

Create a user for a scratch org.

As of February 2, 2023, this command is deprecated and we no longer update this topic.

Don't worry, this command and its flags continue to work the same as before, and any scripts that use the command won’t break. However, we recommend that you start using the equivalent sf-style org create user command instead. Here’s how the flags changed between the old and new commands; if a flag isn't listed, the old and new names are the same:

  • Removed flag: --loglevel
  • Removed flag: --targetdevhubusername
  • Changed flag name: Old name --apiversion. New name: --api-version.
  • Changed flag name: Old name --targetusername. New name: --target-org, with new short name -o.
  • Changed flag name: Old name --setalias. New name: --set-alias.
  • Changed flag name: Old name --definitionfile. New name: --definition-file.
  • Changed flag name: Old name --setuniqueusername. New name: --set-unique-username.

For background information about this change, read this blog post, which describes how we've updated many of the existing sfdx commands to use the improvements we made in sf. We improved this particular command on February 2, 2023.

Warning

Help for force:user:create

Create a user for a scratch org, optionally setting an alias for use by the CLI, assigning permission sets (e.g., permsets=ps1,ps2), generating a password (e.g., generatepassword=true), and setting User sObject fields.

Examples for force:user:create

1sfdx force:user:create
1sfdx force:user:create -a testuser1 -f config/project-user-def.json profileName='Chatter Free User'
1sfdx force:user:create username=testuser1@my.org email=me@my.org permsets=DreamHouse
1sfdx force:user:create -f config/project-user-def.json email=me@my.org generatepassword=true

Command Syntax

sfdx force:user:create
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-a SETALIAS]
[-f DEFINITIONFILE]
[-s]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sf/sf.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional

A username or alias for the target Dev Hub org. Overrides the default Dev Hub org.

Type: string
-u | --targetusername TARGETUSERNAME
Optional

A username or alias for the target org. Overrides the default target org.

Type: string
--apiversion APIVERSION
Optional

Override the API version used for API requests made by this command.

Type: string
-a | --setalias SETALIAS
Optional

Set an alias for the created username to reference within the CLI.

Type: string
-f | --definitionfile DEFINITIONFILE
Optional

File path to a user definition.

Type: string
-s | --setuniqueusername
Optional

Force the username, if specified in the definition file or at the command line, to be unique by appending the org ID.

Type: boolean

force:user:display (Deprecated)

Displays information about a user of a scratch org.

As of February 2, 2023, this command is deprecated and we no longer update this topic.

Don't worry, this command and its flags continue to work the same as before, and any scripts that use the command won’t break. However, we recommend that you start using the equivalent sf-style org display user command instead. Here’s how the flags changed between the old and new commands; if a flag isn't listed, the old and new names are the same:

  • Removed flag: --loglevel
  • Removed flag: --targetdevhubusername
  • Changed flag name: Old name --apiversion. New name: --api-version.
  • Changed flag name: Old name --targetusername. New name: --target-org, with new short name -o.

For background information about this change, read this blog post, which describes how we've updated many of the existing sfdx commands to use the improvements we made in sf. We improved this particular command on February 2, 2023.

Warning

Help for force:user:display

Output includes the profile name, org ID, access token, instance URL, login URL, and alias if applicable.

Examples for force:user:display

1sfdx force:user:display
1sfdx force:user:display -u me@my.org --json

Command Syntax

sfdx force:user:display
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sf/sf.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional

A username or alias for the target Dev Hub org. Overrides the default Dev Hub org.

Type: string
-u | --targetusername TARGETUSERNAME
Optional

A username or alias for the target org. Overrides the default target org.

Type: string
--apiversion APIVERSION
Optional

Override the API version used for API requests made by this command.

Type: string

force:user:list (Deprecated)

List all authenticated users of an org.

As of February 2, 2023, this command is deprecated and we no longer update this topic.

Don't worry, this command and its flags continue to work the same as before, and any scripts that use the command won’t break. However, we recommend that you start using the equivalent sf-style org list users command instead. Here’s how the flags changed between the old and new commands; if a flag isn't listed, the old and new names are the same:

  • Removed flag: --loglevel
  • Removed flag: --targetdevhubusername
  • Changed flag name: Old name --apiversion. New name: --api-version.
  • Changed flag name: Old name --targetusername. New name: --target-org, with new short name -o.

For background information about this change, read this blog post, which describes how we've updated many of the existing sfdx commands to use the improvements we made in sf. We improved this particular command on February 2, 2023.

Warning

Help for force:user:list

The original scratch org admin is marked with "(A)"

Examples for force:user:list

1sfdx force:user:list
1sfdx force:user:list -u me@my.org --json
1sfdx force:user:list --json > tmp/MyUserList.json

Command Syntax

sfdx force:user:list
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sf/sf.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional

A username or alias for the target Dev Hub org. Overrides the default Dev Hub org.

Type: string
-u | --targetusername TARGETUSERNAME
Optional

A username or alias for the target org. Overrides the default target org.

Type: string
--apiversion APIVERSION
Optional

Override the API version used for API requests made by this command.

Type: string

force:user:password:generate (Deprecated)

Generate a password for scratch org users.

As of February 2, 2023, this command is deprecated and we no longer update this topic.

Don't worry, this command and its flags continue to work the same as before, and any scripts that use the command won’t break. However, we recommend that you start using the equivalent sf-style org generate password command instead. Here’s how the flags changed between the old and new commands; if a flag isn't listed, the old and new names are the same:

  • Removed flag: --loglevel
  • Removed flag: --targetdevhubusername
  • Changed flag name: Old name --apiversion. New name: --api-version.
  • Changed flag name: Old name --targetusername. New name: --target-org, with new short name -o.
  • Changed flag name: Old name --onbehalfof. New name: --on-behalf-of, with new short name -b.

For background information about this change, read this blog post, which describes how we've updated many of the existing sfdx commands to use the improvements we made in sf. We improved this particular command on February 2, 2023.

Warning

Help for force:user:password:generate

Generates and sets a random password for one or more scratch org users. Targets the usernames listed with the --onbehalfof parameter or the --targetusername parameter. Defaults to the defaultusername.

If you haven’t set a default Dev Hub, or if your scratch org isn’t associated with your default Dev Hub, --targetdevhubusername is required.

To change the password strength, set the --complexity parameter to a value between 0 and 5. Each value specifies the types of characters used in the generated password:

0 - lower case letters only

1 - lower case letters and numbers only

2 - lower case letters and symbols only

3 - lower and upper case letters and numbers only

4 - lower and upper case letters and symbols only

5 - lower and upper case letters and numbers and symbols only

To see a password that was previously generated, run "sfdx force:user:display".

Examples for force:user:password:generate

1sfdx force:user:password:generate
1sfdx force:user:password:generate -l 12
1sfdx force:user:password:generate -c 3
1sfdx force:user:password:generate -u me@my.org --json
1sfdx force:user:password:generate -o "user1@my.org,user2@my.org,user3@my.org"

Command Syntax

sfdx force:user:password:generate
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-o ONBEHALFOF]
[-l LENGTH]
[-c COMPLEXITY]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sf/sf.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional

A username or alias for the target Dev Hub org. Overrides the default Dev Hub org.

Type: string
-u | --targetusername TARGETUSERNAME
Optional

A username or alias for the target org. Overrides the default target org.

Type: string
--apiversion APIVERSION
Optional

Override the API version used for API requests made by this command.

Type: string
-o | --onbehalfof ONBEHALFOF
Optional

Comma-separated list of usernames or aliases to assign the password to.

Type: array
-l | --length LENGTH
Optional

Number of characters in the generated password; valid values are between 8 and 1000.

Type: integer
Default value: 13
-c | --complexity COMPLEXITY
Optional

Level of password complexity or strength; the higher the value, the stronger the password.

Type: integer
Default value: 5

force:user:permset:assign (Deprecated)

Assign a permission set to one or more users of an org.

As of February 2, 2023, this command is deprecated and we no longer update this topic.

Don't worry, this command and its flags continue to work the same as before, and any scripts that use the command won’t break. However, we recommend that you start using the equivalent sf-style org assign permset command instead. Here’s how the flags changed between the old and new commands; if a flag isn't listed, the old and new names are the same:

  • Removed flag: --loglevel
  • Removed flag: --targetdevhubusername
  • Changed flag name: Old name --apiversion. New name: --api-version.
  • Changed flag name: Old name --targetusername. New name: --target-org, with new short name -o.
  • Changed flag name: Old name --onbehalfof. New name: --on-behalf-of, with new short name -b.
  • Changed flag name: Old name --permsetname. New name: --name.

For background information about this change, read this blog post, which describes how we've updated many of the existing sfdx commands to use the improvements we made in sf. We improved this particular command on February 2, 2023.

Warning

Help for force:user:permset:assign

To specify an alias for the -u or -o parameter, use the username alias you set with the "alias:set" CLI command, not the User.Alias value of the org user.

Examples for force:user:permset:assign

1sfdx force:user:permset:assign -n "DreamHouse, LargeDreamHouse"
1sfdx force:user:permset:assign -n DreamHouse -u me@my.org
1sfdx force:user:permset:assign -n DreamHouse -o "user1@my.org,user2,user3"

Command Syntax

sfdx force:user:permset:assign
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
-n PERMSETNAME
[-o ONBEHALFOF]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sf/sf.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional

A username or alias for the target org. Overrides the default target org.

Type: string
--apiversion APIVERSION
Optional

Override the API version used for API requests made by this command.

Type: string
-n | --permsetname PERMSETNAME
Required

Comma-separated list of permission sets to assign.

Type: array
-o | --onbehalfof ONBEHALFOF
Optional

Comma-separated list of usernames or aliases to assign the permission set to.

Type: array

force:user:permsetlicense:assign (Deprecated)

Assign a permission set license to one or more users of an org.

As of February 2, 2023, this command is deprecated and we no longer update this topic.

Don't worry, this command and its flags continue to work the same as before, and any scripts that use the command won’t break. However, we recommend that you start using the equivalent sf-style org assign permsetlicense command instead. Here’s how the flags changed between the old and new commands; if a flag isn't listed, the old and new names are the same:

  • Removed flag: --loglevel
  • Removed flag: --targetdevhubusername
  • Changed flag name: Old name --apiversion. New name: --api-version.
  • Changed flag name: Old name --targetusername. New name: --target-org, with new short name -o.
  • Changed flag name: Old name --onbehalfof. New name: --on-behalf-of, with new short name -b.

For background information about this change, read this blog post, which describes how we've updated many of the existing sfdx commands to use the improvements we made in sf. We improved this particular command on February 2, 2023.

Warning

Examples for force:user:permsetlicense:assign

1sfdx force:user:permsetlicense:assign -n DreamHouse
1sfdx force:user:permsetlicense:assign -n DreamHouse -u me@my.org
1sfdx force:user:permsetlicense:assign -n DreamHouse -o "user1@my.org,user2,user3"

Command Syntax

sfdx force:user:permsetlicense:assign
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
-n NAME
[-o ONBEHALFOF]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sf/sf.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional

A username or alias for the target org. Overrides the default target org.

Type: string
--apiversion APIVERSION
Optional

Override the API version used for API requests made by this command.

Type: string
-n | --name NAME
Required

The name of the permission set license to assign.

Type: string
-o | --onbehalfof ONBEHALFOF
Optional

Comma-separated list of usernames or aliases to assign the permission set license to.

Type: array