Sub topic 3
Which orgs can be a Dev Hub and who can use it
This chapter assumes you can sign in to a Salesforce org as an administrator, know where Setup is, and have read the previous chapter on what a Dev Hub does. Here you will learn which orgs can be a Dev Hub and which users can work with one.
Orgs that can be a Dev Hub
You enable Dev Hub in an org that is long-lived and holds your licenses. These orgs qualify:
- Production orgs on editions that include Dev Hub, such as Enterprise, Unlimited, and Performance.
- Developer Edition orgs.
- Trial orgs, including Dev Hub trial orgs.
These orgs cannot be a Dev Hub:
- Sandboxes.
- Scratch orgs.
The restriction follows from the Dev Hub's job. It records every scratch org it creates, so it must outlive them. A sandbox can be refreshed or deleted, and a scratch org expires.
Choosing between them
The choice mostly comes down to the scratch org limits, which depend on the edition. A Developer Edition or trial Dev Hub allows far fewer active and daily scratch orgs than a production Enterprise or Unlimited org. A later chapter shows how to read your exact limits. For now, use a Developer Edition org to learn. For a team, use the production org.
A trial Dev Hub is also temporary. If the trial ends, you lose the Dev Hub and the record of its scratch orgs.
Who can use it
Two groups of people interact with a Dev Hub.
- The person who enables it. This needs an administrator who can change Setup. A system administrator can do it.
- Developers who create scratch orgs. They sign in to the Dev Hub through the CLI, so each one needs a user in the Dev Hub org with API access. System administrators have what they need by default. For other users, an administrator grants the Dev Hub-related permissions through a permission set. Check the current Salesforce documentation for the exact permission names, because they have changed between releases.
Developers use their own Dev Hub login, so every scratch org is tied to the user who created it. Scratch orgs are not billed as separate licenses. They count against the Dev Hub's limits.
Check that Dev Hub is on
After you enable Dev Hub, you can confirm it from the CLI. Dev Hub orgs expose the ScratchOrgInfo object, which records scratch orgs. This query fails on an org that is not a Dev Hub.
sf data query --query "SELECT Id FROM ScratchOrgInfo LIMIT 1" --target-org my-hubAn empty result is fine. It means Dev Hub is on and no scratch orgs exist yet. An error that says the object is not supported means Dev Hub is off, or you queried the wrong org.
Exercise
A colleague wants to use their full-copy sandbox as the Dev Hub for the team. Is that possible, and what should they use instead?
Show answer
No. Sandboxes cannot be a Dev Hub because they can be refreshed or deleted, and the Dev Hub must persist to track scratch orgs. They should enable Dev Hub in the production org, or in a Developer Edition org if they only want to practice.