Sub topic 4
Authorizing a deployment connection
This chapter assumes you can work in Setup, know the difference between a production org and a sandbox, and have a user with the Deploy Change Sets permission in both orgs. It covers how Salesforce decides which orgs may exchange change sets, how to authorize that path, and what goes wrong when the authorization is missing.
Why a connection is needed
A change set does not travel to an arbitrary org. Salesforce only lets you upload a change set to an org that has an authorized deployment connection to the org you are working in. The connection is a one-way permission. It says that the target org accepts inbound change sets from the source org.
This matters because the connection is configured in the target org, not in the source org. You do not "push" your way in. The target org opts in to receiving changes, and the source org then sees that target in its list of upload destinations.
Two terms are used throughout:
- A deployment connection is a record of a trusted path between two orgs. It lives in the target org's Setup.
- An outbound change set is a change set you build and upload in the source org. The target org later sees it as an inbound change set.
Which orgs are connected by default
Orgs that belong to the same production org family are connected automatically. A production org and the sandboxes created from it can exchange change sets without any extra setup. Salesforce creates the connections when it creates the sandbox.
The default rules are:
- A sandbox can send change sets to its production org and to other sandboxes in the same family.
- A production org can send change sets to its sandboxes.
- A sandbox refreshed or created from a production org keeps its connection to that org.
- Two unrelated production orgs are not connected. Change sets cannot move between them.
The exact direction rules can differ by org type and by what your administrator has changed. Treat the Deployment Settings page, described below, as the source of truth for your org, not this list.
Reading the Deployment Settings page
To see the connections for the org you are in, open Setup and search for Deployment Settings. Use the Quick Find box. The page lists every org that is related to this one.
Each row shows:
- The org name.
- The org type, such as production or sandbox.
- An Authorize Inbound Changes link, or the word Authorized or Not Authorized, depending on the state.
The key point is the direction of the status. The status in a row describes whether this org accepts inbound changes from the listed org. It does not describe whether this org can send to the listed org. That is decided in the other org's Deployment Settings page.
Authorizing a connection step by step
Suppose you want to deploy from a sandbox named UAT to production. Production must authorize inbound changes from UAT. You do this in production.
- Log in to the target org, in this case production, as a user who can modify deployment settings. This is typically a system administrator.
- From Setup, enter Deployment Settings in the Quick Find box and select it.
- Find
UATin the list of connections. - Click Authorize Inbound Changes next to it.
- On the confirmation page, click Save.
The row now shows that inbound changes from UAT are authorized. Log in to UAT, start an outbound change set, and click Upload. Production now appears as a destination.
If you also want to send changes the other way, for example from production back to UAT, repeat the process in UAT and authorize inbound changes from production.
Checking your work from the command line
A connection only controls where change sets can go. It does not tell you what will be in them. Before you build a change set, it helps to know what the source org actually contains. A manifest is a file that lists metadata by type and name. It is the same kind of list a change set holds.
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>Invoice__c</members>
<name>CustomObject</name>
</types>
<types>
<members>InvoiceService</members>
<members>InvoiceServiceTest</members>
<name>ApexClass</name>
</types>
<version>61.0</version>
</Package>You can retrieve those components from a sandbox with the Salesforce CLI and compare them with what you plan to add to the change set.
sf project retrieve start --manifest manifest/package.xml --target-org MySandboxThe retrieve uses a separate authentication to the sandbox, through the CLI. It does not use or need the deployment connection. The two mechanisms are independent. A CLI login lets you read an org. A deployment connection lets a change set land in an org.
Permissions involved
Two different permissions apply, and people often mix them up.
| Permission | Where it is needed | What it allows |
|---|---|---|
| Deploy Change Sets | Source and target org | Create, upload, validate, and deploy change sets. |
| Modify All Data or administrative access to deployment settings | Target org | Authorize inbound changes on the Deployment Settings page. |
| Upload External Change Sets | Source org | Upload a change set to an org. |
Having Deploy Change Sets does not let you authorize a connection. A developer who can build and upload change sets may still have to ask an administrator of the target org to authorize the path. Profile and permission set names can vary by edition and release, so check the permissions in your own org if a button is missing.
Common problems
The target org is not in the upload list. The target has not authorized inbound changes from the source. Open Deployment Settings in the target and authorize it. Then reload the upload page in the source.
The Authorize Inbound Changes link is missing. You may be looking at the wrong org. The link is on the target's page. Also check that your user has the permission to change deployment settings.
A sandbox was refreshed and the connection looks different. A refresh rebuilds the sandbox from its production org. Check Deployment Settings after a refresh and re-authorize any path you rely on. Do not assume the earlier state survived.
Two unrelated production orgs. No connection is possible. Use another tool, such as the Metadata API or the Salesforce CLI, covered in a later chapter.
You authorized the wrong direction. If you authorized inbound changes in the source org, nothing changes for the path you wanted. Authorize in the org that will receive the change set.
Security considerations
An authorized connection is a trust decision. Anyone who can upload a change set from the source org can place components in the target's inbound list. They cannot deploy it without a user in the target org who has the Deploy Change Sets permission. That separation is deliberate. The target org's administrators keep the final say.
Good practice:
- Authorize only the paths you use. Do not authorize every sandbox in the list.
- Keep production's list short. A developer sandbox rarely needs a direct path to production if every change goes through a testing sandbox.
- Review the list after a sandbox is created or refreshed.
- Remember that an unauthorized connection can be re-enabled later, so you lose nothing by being strict.
What authorization does not do
Authorizing a connection does not:
- Move any metadata by itself.
- Validate or deploy a change set.
- Add dependent components. That is handled when you build the outbound change set, in the next chapter.
- Grant any user the right to deploy.
It only opens the path.
Exercise
You are a developer in a sandbox named DevOne. You build an outbound change set, click Upload, and production is not listed as a destination. Which org do you check, which Setup page do you open, and what action do you take?
Show answer
Check production, the target org. Open Setup, then Deployment Settings. Find DevOne in the list and click Authorize Inbound Changes, then save. The authorization lives in the receiving org. After that, reload the upload page in DevOne and production appears. If you cannot authorize it yourself, ask a production administrator, because Deploy Change Sets alone does not allow you to change deployment settings.
Exercise
A teammate says "I authorized the connection in the sandbox, so now the sandbox can send to production." Is that correct? Explain.
Show answer
No. The sandbox's Deployment Settings page controls what the sandbox accepts from other orgs. To let the sandbox send to production, production must authorize inbound changes from the sandbox. The teammate opened the wrong org, so the upload destination list in the sandbox is unchanged.