I have written about remote development in the past (1, 2), but in the last couple of month and years, I have also had more and more occasions where it just is nice to easily create a test VM on Azure. For both scenarios, setting up key-based SSH is a good idea or even a requirement, but it can be a bit tricky. To solve that and make it very convenient, I have created a quickstart template for a Windows Server VM with SSH. With only a couple of clicks, you get a test / dev VM and can immediately connect.


Here are the steps to get up and running: Click on the deployment link, enter the basics (subscription, resource group, region, SKU, VM size and data disk size) and define admin username and SSH key. Then you only need to click on “Review + create” and then “create”, wait for approx. five minutes and you are done.

If you are wondering how to set up the SSH key, here are the docs on storing it in the Azure portal.

The details: Using it

As I already wrote about the basic setup (see above) and it actually is very easy, I want to show a bit more on how I use it instead of how it is created:

For a VM that I plan to use longer or for VS Code remote, I create an entry in my SSH config file, which by default is in your home folder, subfolder .ssh, file config. As you have seen, the hostname is randomly generated, so I give it a name that is easier to remember and because I tend to be not very consistent with the username (sometimes vmadmin, sometimes vmadministrator, sometimes tfenster and more…), I also enter that as well. So an entry for the config file could look like this

Host ssh-vm
  HostName winssh-aroeeg4rupu2i.northeurope.cloudapp.azure.com
  User vmadmin

With that in place, I can just use ssh ssh-vm. Now, because I tend to even forget that, I also set up a Windows Terminal profile. In this example, I would put “ssh-vm” as name and ssh ssh-vm as command. Afterwards, I can just use the dropdown when creating a new tab in the terminal and be immediately connected.

Screenshot of Terminal profiles

And VS Code also automatically picks up the SSH config file, so using it for remote dev is also very easy.

Screenshot of VS Code remote dev SSH targets

I hope this little time saver helps you to become more productive.