Server Bug Fix: How can I get Azure to use an SSH key when doing a node.js deploy via git?

Original Source Link

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?

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, and replace /deploy
    with /api/sshkey?ensurePublicKey=1. So it’ll look like
    https://$mysite:[email protected]/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

Tagged : / / /

Leave a Reply

Your email address will not be published. Required fields are marked *