SFDX Usernames & Orgs

Salesforce DX Sandbox Config

Before you start developing with Salesforce DX, I recommend that you set your org and default username. The setdefaultusername parameter sets all Salesforce projects to use this org/scratch-org when using sfdx commands. This command is very helpful if you support multiple Salesforce projects.

sfdx cli command
sfdx force:auth:web:login --instance-url https://test.salesforce.com --setdefaultusername --set-alias my-alias
  • instance-url: provide the url for your Salesforce domain that you want to authenticate with.
  • setdefaultusername: tell sfdx to use this username/org for all projects.

How to check which username is set?

sfdx force:org:list

The output will list all Orgs that your sfdx client is connected too. The org with the (U) next to the Alias is your default username.

Leave a comment