I need to use a Windows machine for a program that only works on Windows. I set up a Windows 10 virtual machine on Azure. On the Azure portal, at the virtual machine, under Connection, I see the details for RDP and it works with the Microsoft Remote Desktop app from the app store.

I also want to connect with SSH. Clicking on that item next to RDP, I see:

Ensure you have read-only access to the private key.
chmod 400 <name>.pem

without any indication of where to download or upload that key.

I opened port 22 on the Azure portal following these directions, and I also installed OpenSSH Server following the PowerShell section of these directions, including starting the service:

> Set-Service -Name sshd -StartupType 'Automatic'
> Get-NetFirewallRule -Name *ssh*

Name                  : OpenSSH-Server-In-TCP
DisplayName           : OpenSSH SSH Server (sshd)
Description           : Inbound rule for OpenSSH SSH Server (sshd)
DisplayGroup          : OpenSSH Server
Group                 : OpenSSH Server
Enabled               : True

From my local machine, the SSH times out to the public IP of the virtual machine:

$ ssh user@<public-ip>
ssh: connect to host <public-ip> port 22: Operation timed out

I am able to SSH into other virtual machines, so I don't think my firewall is the problem.

How can I connect to a Windows 10 virtual machine over SSH?


This error was prompt because you connect to the server without private key, that is requirement. Look at this site: https://docs.microsoft.com/en-us/azure/devops/repos/git/use-ssh-keys-to-authenticate?view=azure-devops&tabs=current-page and try upload your public key after generate pair of key.

Also you might get the established TCP connections, to make sure everything with ssh server is ok, by this command on PowerShell:

Get-NetTCPConnection -State Established

  • I can't see where I can upload my public key. On the Azure portal at the virtual machine instance, clicking "Security" brings me to the security center, and searching for "ssh" or "key" returns nothing. The linked page seems to be for Azure DevOps, not for Azure, since I see no item "Security" under my avatar. I have set up SSH authentication for Linux machines in the past. Does it also work for Windows machines? May 11 '20 at 18:13
  • 1
    Yep, you have right, sorry for the bad link. I searched again about verifying ssh on Windows VM in Azure and didn't see anything about it, so i think that you should try with SSH authentication for Linux machine, as you wrote. EDIT: Ops, ok, i see your next comment ;)
    – KryDee
    May 12 '20 at 6:30

It seemed only a matter of time, as the setup is now working two hours later with password authentication.

On a different try, restarting the machine also worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.