Where are auto generated SSH keys stored in Windows using azure cli --generate-ssh-keys
From MSDN for --generate-ssh-keys
:
Generate SSH public and private key files if missing. The keys will be stored in the ~/.ssh directory.
Which will by default create a private id_rsa
and public id_rsa.pub
SSH key pair in the ~/.ssh
directory if they don't exist. If you already have existing SSH keys in that location, it will just use those and not overwrite them.
On Windows this is the C:\Users\username\.ssh
directory.
Additionally, you could also pass in a specific SSH public key path with --ssh-key-values
:
az vm create \ --resource-group myResourceGroup \ --name myVM \ --image UbuntuLTS \ --admin-username azureuser \ --ssh-key-values /path/to/public/key
This is particularly useful if you have created SSH keys in another location with ssh-keygen
.
As @Ash pointed out in the comments, you could have a look at Generate keys automatically during deployment for more information.
You can find it under
C:\Users\<<your-user-name>>\.ssh
When you create a VM for the first time you get the below message as well
SSH key files 'C:\Users\<<your-user-name>>\.ssh\id_rsa' and 'C:\Users\<<your-user-name>>\.ssh\id_rsa.pub' have been generated under ~/.ssh to allow SSH access to the VM. If using machines without permanent storage, back up your keys to a safe location.
For subsequent VM creations, the same key pair is used and you don't see the message again.
(I verfied using Windows OS, creating a linux VM with RedHat:RHEL:7-RAW:7.4.2018010506 image via Azure CLI)