phtanko on Thu, 15 Feb 2018 16:19:55
I am trying to get access to a VM I am setting up via resource manager using SSH, but from the Azure Cloud Shell. The Cloud Shell is the free CLI one can access from the Azure Portal.
Unfortunately, when I try to copy and paste my public key into the creation process, I get a red exclamation mark that says "SSH key must be encoded in base54".
My SSH key, from what i can see, is in base 64.
Its format is "ssh-rsa lotsofgibberishhere" , without the quotes of course.
The actions I have taken are
1. Create a new key pair for my Cloud Shell user using
ssh-keygen -t rsa -b 4096 -C "foo"
2. Opening the public key in nano text editor using
3. Using right click to copy the entire key since clip doesn't work as this is being run on Cloud shell, not your own terminal.
4. Pasting the public key into the prompt when creating a new VM, getting the "base64" encoding warning.
Is there a recommended way to ssh into VMs from Cloud Shell? I am aware that one can SSH into a VM from cloud shell, per https://docs.microsoft.com/en-us/azure/virtual-machines/linux/quick-create-portal . However, the VM I am working with is created from a template from Azure marketplace, and includes the prompt to paste in an SSH key, and my pasted key is being rejected for "must be encoded in base64".
Marcin Policht on Thu, 15 Feb 2018 16:49:23
For info regarding copy/paste operations, refer to https://docs.microsoft.com/en-us/azure/cloud-shell/using-the-shell-window
Regarding the SSH key, you might want to consider copying them directly to the file share that Cloud Shell uses. The public and private keys used to authenticate your VM are placed in /home/<user>/.ssh/id_rsa and /home/<user>/.ssh/id_rsa.pub by Azure CLI 2.0 by default. The .ssh folder is persisted in your attached Azure Files share's 5-GB image.
phtanko on Fri, 16 Feb 2018 15:45:35
Thank you for the links, but I will clarify my issue.
I can copy text within Cloud Shell. I have to do it in chunks since there is no auto scroll, but I have the entire public key.
However, pasting the public key when prompted when creating a new instance, gives me a "must be encoded in base64" error. This is my main issue. The public key I have is base64 afaik, and because of the error I can't use SSH public key authentication. I've included a screenshot below to illustrate the problem. I've partially covered up the public key just because, but I know it can be freely shared.
Hovering over the red exclamation gives the following error shown below.
The weird thing is that if I truncate the public key, the prompt accepts it without complaint. However, obviously when I do set this up and try to ssh inside, I am unable to do so, because of public key mismatch due to truncation.
What steps should I take to diagnose this issue. True, there is a good chance of user error due to that copy and paste from cloud shell, but I think I have the correct key. In any case I believe I have the key in base64 so I don't think that was the issue. What steps should I take to find out why I get a "base64" error for my pasted ssh publickey?
PRADEEP CHEEKATLA on Tue, 20 Feb 2018 03:51:11
I’m able to create Azure Linux VM with same steps, which you described.
Using CloudShell created SSH key pair as follow:
And copy and pasted public key into the prompt when creating a new VM, and created VM successfully.
Do click on "Mark as Answer" and “Vote as Helpful” on the post that helps you, this can be beneficial to other community members.