I'm glad to write this post about my experience in connecting linux vm. Below are the number of steps to be taken. Keeping this short and simple.
- Create Linux VM on Azure
- Enable SSH connectivity You must enable port 22 for SSH connectivity and create VM with default options.
- Download Private Key as prompted. It will be .pem file.
- Once downloaded, VM will be created for you. Go to Virtual Machine-->Settings-->Connect
Now here is a twist. People don't know how to use that .pem file downloaded as generally private and public key are contained in id_rsa and id_rsa.pub files. Also when you will open that .pem file that contains --BEGIN RSA PRIVATE KEY-- AND --END RSA PRIVATE KEY--
The most important thing is that you don't need to copy rsa key between --BEGIN RSA PRIVATE KEY-- AND --END RSA PRIVATE KEY--. You just need to pass path of that .pem file in the last command listed above. Ignore other commands.
You can use powershell or Git Bash cli to SSH Linux VM but make sure to download git BASH cli then only SSH command will be supported in powershell. You you can use any other tool/cli if you want. I prefer powershell and git bash.