Recently Microsoft published a new extension for VS Code where we can deploy and manage a Linux VM on Azure. With this extension, we can Create, Start, Stop, Delete, and Add SSH Key.
Prerequisites
- An Azure Subscription (Sign up for a free Azure account by clicking here)
- Visual Studio Code (Download the VS Code from here)
Get the extension
There are two ways we can get the Azure Virtual machines extension.
- Download and install from the Visual Studio Market place from this link
- Install it from the Visual Studio Code
-
- From the manage button, select Extension or press CTRL+SHIFT+X and search for {azure virtual machines} and click to Install, as the image below shows.
-
Create a Virtual Machine
Since we have installed the extension we are ready to create the virtual machine by following the next steps.
Step 1. Sign in to Azure
First, we have to sign in to Azure by using the Microsoft account.
Once we are signed in to azure successfully, then a new page will open (like the one in the image below).
Note: Before you begin with the deployment make sure that .ssh folder exist into the path C:\Users\USERNAME\.ssh
Step 2. Create the Virtual Machine
Select + to create a new Azure virtual machine, this wizard has 3 steps, the first is to type the VM name
the second is to enter a passphrase, or we can leave it empty
and the third one is to select a region for the deployment
When the deployment finishes we can see into our subscription a new Resource Group name DemoVM and an azure VM with Linux (ubuntu 18.04) image and size Standard D2s v3 (2 vcpus, 8 GiB memory).
And of course, we can do some things from the Visual Studio Code like Start, Stop, and Delete the VM or Add an SSH Key.