Adding SSH Keys to Windows Azure
Better late then never, and it could be usefull for others :
A Web App already have a ssh key, to get it :https://[web-site-name].scm.azurewebsites.net/api/sshkey?ensurePublicKey=1
You can then add this key to you git repo deploy key.
I've never set that up in Azure but some general rules of thumb for handling SSH keys:
- The private key in
$HOME/.ssh/
must have file mode 600 (RW only for the owner) - You need both, the public and the private key in this folder, usually named
id_rsa
andid_rsa.pub
but you can change the filename to whatever you like - You have to convert the private key generated by puttykeygen to a OpenSSH2 compatible format, see How to convert SSH keypairs generated using PuttyGen
known_hosts
stores the public keys of the servers you've already connected to. That's useful to make sure that you are really connecting to the same server again. more detailed information on this topic
HTH
So if you like me had multiple private submodules on the same github account as the app service is deployed at you can give your service access to all your modules by moving the deployment key.
- Go to the repo where your service is hosted.
- In settings go to deploy keys.
- Remove the deployment key.
- Get the public key from https://[your-web-app].scm.azurewebsites.net/api/sshkey?ensurePublicKey=1
- Add the key to your SSH keys in the account settings for github.
- If you have modules on several accounts you can add the same key to each account.
After this the service can access private repos on all accounts with the key.