Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Latest commit

 

History

History
18 lines (13 loc) · 1.73 KB

connecting-environments.md

File metadata and controls

18 lines (13 loc) · 1.73 KB

Connecting Environments

Environments (Sandbox) need to be connected to the CI/CD pipelines for deploying packages to an environment. The preferred authentication mechanism for integrating environments to pipelines is to utilize SFDX AUTH URL based authentication. The environment should also be provisioned with a service user (API only user, with a System Admin Profile) and should have the same username.

Each sandbox needs to have the below secret being added to a secrets manager in your CI/CD system or a dedicated secrets manager such as AWS Secrets Manager or Azure Key Vault. Then a new stage is supposed to be created in your CI/CD flow based on your environment strategy.

Naming Pattern in Secrets Manager Description
SFDX_AUTH_URL <ALIAS>_SFDX_AUTH_URL The Auth URL for a particular environment. This consists of the access token which the salesforce CLI uses to authenticate to the environment
//Replace <alias> with alias of your environment
SFDX_AUTH_URL=`aws secretsmanager get-secret-value --secret-id $(<alias>_SFDX_AUTH_URL) --query SecretString --output text | jq -r .<alias>_sfdx_auth_url`
echo $SFDX_AUTH_URL > .authfile
sfdx auth:sfdxurl:store -f .authfile -a <alias>

The above script demonstrates how one can fetch the secrets from AWS Secrets Manager