Creating and Connecting Linux Ubuntu VM in Azure
Microsoft love Linux. Linux operating systems fully supported in Azure public cloud. There are 2 ways to connect Linux VM in Azure; via a user name and password and via a public / private key. Using a public /private key is the recommended option to securely connect to the Linux based VMs. To create a public/ private key pair, you use puttygen tool for this. To log into the Linux instance, you use putty tool or MobaXterm. You can use puttygen tool to generate a Public and Private key for creating SSH keys. The public key is infused in the serve during the creation period and the private key is used during log into the instance.
First ensure to download the following tools:
a.) PuttyGen – Used to generate the public and private keys – https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
b.) MobaXterm – https://mobaxterm.mobatek.net
1. Open PuttyGen tool and click on the Generate button.
2. Keep on hovering your mouse around till the keys are generated.
3. Once the keys are generated, ensure to save your public and private key file safely.
Creating Azure Virtual Machine using the 7-step workflow
1.Open the Azure Portal and navigate to Virtual Machines. In the new Windows, click on the +Add button.
2. On the Create a virtual machine Basics page, under Project details, make sure the correct subscription is selected and choose to Resource group name as given below.
PROJECT DETAILS
Subscription: MSDN Platforms
Resource group: MSSERVERPRO-ASA-RG01
3. Under Instance details, type ubuntu for the Virtual machine name and choose Southeast Asia for your region. Choose No infrastructure redundancy required for Availability options. For image select ubuntu Server 18.04 LTS and for Disk size select Standard D2s v3
INSTANCE DETAILS
Virtual machine name: ubuntu
Region: Southeast Asia
Availability options: No infrastructure redundancy required
Image: Ubuntu Server 18.04 LTS
Size : Standard D2s v3 2 vcpus, 8 GB memory
4. Under Administrator account, select Authentication type as SSH public key and provide a username as ubuntu. Copy Public key from PUTTY Key Generator and paste into SSH public key box.
ADMINISTRATOR ACCOUNT
Authentication type: SSH public key
Username: ubuntu
SSH public key: ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAmq3H5KISTlNE/xvRgxlkDXmzHIfPhwzh6al0/ZVH6L3Ll1pc8mNLG6UxFZhQmVtSxAQpQEtCSqQGHyQiv165vemWUzw7EtopihK+VZDms1SO7Cd1j2kcgl+BBI+mMUeeY1Y55veP7WAmUmX7CFWqUShDY/cGXUEeVGTlCgvL0xnEnLmWOtbHhkb/oXtXn3xJw+T9H111gz31Ldj8fdZg5ITy0kTS6len4//YpQghhKO6PKeIywXY4bkFzLK28vBYoho4DDl5IvLdD7cLPQLQxSjMnTgZiqrVyZaPy0ycfesA2o1byETvmQnB9BVHcw6HFhowzN7VbUN/3+kJXyo3qw== rsa-key-20181229
5. Under Inbound port rules, choose Allow selected ports and then select SSH (22) from the drop-down.
INBOUND PORT RULES
Public inbound ports: Allow selected ports
Select inbound ports: SSH (22)
6. Click on Next: Disks button.
7. On the Create a virtual machine Disk page, select disk options for OS disk type as Premium SSD and click Next:Networking button.
8. On the Create a virtual machine Networking page, configure virutal networks and click on Next: Management button.
9. On the Create a virtual machine management page, click on Next: Guest config button.
10. On the Create a virtual machine Guest config page, click on Next: Tags button.
11. On the Create a virtual machine Tags page, provide following values,
Key: Name
Value: Ubuntu
Click on Next: Review Create button.
12. On the Create a virtual machine Review+ create page, verify Validation passed and click on Create button.
13. Verifying that “Your deployment is underway” …
14. Verify that deployment is complete.
To connect to Ubuntu Linux VM from Windows using MobaXterm
1. From the ubuntu virtual machine console, copy the Public IP address of the ubuntu virtual machine.
2. Open MobaXterm and click on Start local terminal. follow the given below steps to connect to ubuntu virtual machine.
Summary:
I hope this article help you to create Ubuntu Linux virtual machine in Azure using public key and private key which is the recommend options to securely connect to the Linux based VMs.