Named Credentials Packaging Guide

Salesforce supports packaging for named credentials. With Salesforce DevOps Center and your version control system, you can create managed 2GP and unlocked packages to promote named credentials from a development to a production environment and distribute named credentials across many orgs. Then, you can automate the population of authentication tokens across orgs so users can make authenticated callouts.

The packaging and deployment process for named credentials involves these high-level steps.

  1. Create the named credential in a development environment.
  2. Extract all metadata for the named credential from the Salesforce org, move it to a version control system, and create the managed 2GP package.
  3. Install the managed 2GP package in the target org.
  4. Use the Connect API to populate the external credential’s principal in the target org.
  5. To verify that credentials work as expected, make a test callout in the target org.

After you install the named credential in the target org, you can also upgrade the package and reinstall it without overwriting the credential’s principals.

For more information about these steps, review each section.