2

I'm deploying a node.js app to Azure Web Services using git from my local machine via: git push azure master

One of our npm packages is a private repo hosted on BitBucket. Without Azure having an SSH key to clone that repo, the deployment fails.

How can I add an SSH key to my Azure server that will get used during these deployment executions?

SomethingOn
  • 123
  • 5

1 Answers1

0

You'll need to setup a deployment key on Bitbucket that you can provide to Azure to get the package from Bitbucket.

  1. Take the full deploy URL (such as https://mysite.scm.azurewebsites.net/deploy), and replace /deploy with /api/sshkey?ensurePublicKey=1. So it'll look like https://$mysite:BigRandomPassword@mysite.scm.azurewebsites.net/api/sshkey?ensurePublicKey=1
  2. Run curl on this URL, which returns an SSH public key. It's returned as a JSON string, so you'll need to remove the quotes. It should look like ssh-rsa AAAAB3NzaC1etc...
  3. Set this string as a 'deploy key' on your GitHub/Bitbucket/GitLab repository.

Full source here

Sam Cogan
  • 38,736
  • 6
  • 78
  • 114