New VM Can't connect SSH port 22 - Permission Denied

When you creating new VM with generate key pair option, it should be downloaded on your drive (by default on Download folder). Then you need to insert privatekey.pem when connecting over ssh by adding -i attribute :

ssh -i keypair.pem [email protected]
#or
ssh -i C:\pathtofolder\keypair.pem [email protected]

But if you forgot or lost your keypair from azure. you can create new one using puttygen. Complete guide you can see in https://www.digitalocean.com/docs/droplets/how-to/add-ssh-keys/create-with-putty/

  1. Download and open puttygen. click generate and move your mouse randomly on the blank area until finish
  2. Save Private key on your machine, and copy public key
  3. go to azure, choose your VM. in left menu, choose Reset password and use public key option. then paste your public key Reset Password / SSH public key

4. it will create new user or updating the existing one 5. Double-click previously saved private key from puttygen, it will run as background service 6. Now you can ssh without adding -i attribute