How to ssh to Azure VM using private IP address from internet

You can't SSH from your local machine to your VM with a private IP because your machine isn't in the same network as the VM. You would only be able to SSH to the VM from another VM on the same virtual network.

In order to SSH to your VM from outside of the vnet you will need a NIC attached with a Public IP and the default port of 22 open on your Network Security Group.

Edit: because I couldn't find a relevant document for this I wrote a blog post. https://medium.com/@joelatwar/how-to-ssh-to-your-azure-linux-vms-with-username-and-password-from-windows-linux-or-mac-df7d07ea3be1


I have found some other way working.

Temporarily attach the VM with private ip address under a public azure lb, configure a nat rule for ssh in the load balancer.make sure you have allowed the ssh from inside vnet in the nsg where the vm is attached.

SSH into the public load balancer ip and you will be able to access the internal machine via azure load balancer ip.