Azure DevOps and Salesforce DX

This post is mainly to save my findings on a project, so I don’t have to start from scratch next time I’ll configure CD.

When defining the pipeline on Azure DevOps start from scratch and use the following:

Pull Request validation

The above definition is for validation only when pull request is created (section PR, will trigger whenever new PR to master is created or updated) or target branch is updated (section trigger, any feature branch). It will install sfdx (line 27), authenticate org based on token stored in file (line 30) and deploy the code from the whole repo for validation only (line 33).

Daily deploy

This part is for daily push to the org as we didn’t want to update the code base during the day when testers are testing. On daily basis (2am, line 7) we take the master and release branch and deploy to two different orgs.

How to get the access token

The sfdxqaauth.txt contains the access token which you can get with the following command:

sfdx force:org:display --targetusername <username> 

Take the Access Token value and combine it into following:

force://PlatformCLI::AccessToken@yourdomain.my.salesforce.com

Leave a Reply