I am currently trying to automate the whole process for working with Sandboxes in my company. As of now, we have a CLI tool which both refreshes the sandboxes and executes an Apex anonymous script to seed the DB and set some Custom Settings, etc.

The issue I have is I would now like to further automate this so that our git remote repository is pushed to the Sandbox once the refresh as been completed.

Initially, I thought of setting up a quick web application in Azure which a Sandbox PostCopy script would call once it had finished but the main stopper I have found is how to obtain the credentials programatically.

AFAIK, you can reset passwords, security tokens, etc. via the Tooling API, but I don't know a way to give my Azure service the current credentials for the Sandbox once it has been refreshed.

My idea is to have this whole pipeline automated. Is it possible?

  • If you create sandbox, login is changed (suffix is added), but password and token are same, as they are on production. So you can use it as starting point – kurunve Jul 3 '18 at 11:03
  • I haven't tried it, but it sounds like the same JWT-Connected App flow used in Salesforce DX might work nicely here. It would involve giving the Azure app access to Production, though. – David Reed Jul 3 '18 at 11:29
  • @DavidReed I'm aware of the flow since we use it for some Powershell integrations we have, but it's only available via de CLI, and therefore using only CLI commands afterwards, right? – Javier García Manzano Jul 4 '18 at 7:09
  • Hmmm. I mean, once you have a valid session ID it's valid wherever the running user has permission to connect. Are you not trying to use CLI? – David Reed Jul 4 '18 at 11:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.