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?

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

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.