A quick post of how to work with ssh keys using MS azure.
Making a key pair:
ssh-keygen -t rsa
In this example, use the defaults. (Hit ENTER till the key is created.)
You should have a key in:
ls .ssh/id_rsa
Given an Azure Keyvault that you haver previously created, find that vault:
az keyvault list
For this example, let's call it "mykeyvault".
Upload the key.
az keyvault secret set --name sshkey --vault-name mykeyvault --file ~/.ssh/id_rsa
List the keys:
az keyvault secret list --vault-name mykeyvault
Now we can get the key:
az keyvault secret download --name sshkey --vault-name mykeyvault --file sshkey.pem
This should create a file which is the same as ~/.ssh/id_rsa. Prove it with diff.
diff ~/.ssh/id_rsa sshkey.pem
Top comments (0)