'Azure Cloud Shell : Permission denied (publickey)

I am trying to access a VM created with the ssh file and when i tried to execute the command , i am getting the following error,

ssh azureuser@publicIpAddress

I get this error

Permission denied (publickey)

and i am not able to connect to VM. any idea where is the problem?



Solution 1:[1]

I had the same issue in the past, Please try with the below command which explicitly specifies which key to use.

ssh -i ~/.ssh/id_rsa azureuser@yourpublicip

where .ssh/id is the key that you generated

Solution 2:[2]

generate new public key

ssh-keygen

display key to add to azure

ssh-agent sh -c 'ssh-add; ssh-add -L'

then in azure add the new key Virtual machines > Reset password > Reset SSH public key

done.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sajeetharan
Solution 2 Shadow Angel