Also CheckIn this blog, we are going to discuss how to create an Ubuntu Azure Virtual Machine and connect to it.
The following sections have been covered in this blog:
- What is Azure Virtual Machine?
- Prerequisites
- Creating An Ubuntu Virtual Machine
- Connecting To Ubuntu Virtual Machine
This blog talks about technologies that are part of the Azure Cloud Administration. If it’s something in which you have an interest or you want to learn it then you can visit our previous blog to know more about the [AZ-104] Microsoft Azure Administrator certification.
What is Azure Virtual Machine
Azure Virtual Machines (VM) is one of several types of on-demand, scalable computing resources that Azure offers. Typically, you choose a VM when you need more control over the computing environment than the other choices offer. This article gives you information about what you should consider before you create a VM, how you create it, and how to connect to it.
An Azure VM gives you the flexibility of virtualization without having to buy and maintain the physical hardware that runs it. However, you still need to maintain the VM by performing tasks, such as configuring, scale-up/down the machine, and installing the software that runs on it.
Azure virtual machines can be used in various ways. Some examples are:
- Development and test – Azure VMs offer a quick and easy way to create a computer with specific configurations required to code and test an application.
- Applications in the cloud – Because demand for your application can fluctuate, it might make economic sense to run it on a VM in Azure. You pay for extra VMs when you need them and shut them down when you don’t.
- Extended datacenter – Virtual machines in an Azure virtual network can easily be connected to your organization’s network.
The number of VMs that your application uses can scale up and out to whatever is required to meet your needs.
To download the complete AZ-104 Azure Admin Sample Questions guide click here.
Prerequisites
- An Azure Cloud Account ( you can learn how to create one from our previous blog here.)
- Access to an SSH client: for this tutorial, we will be using Putty and Putty Key Generator installed on our Windows computer for accessing our Ubuntu Virtual Machine.
Creating An Ubuntu Virtual Machine
Step 1: In the Azure portal, search for Virtual Machine and select Virtual Machine.
Note: Please make sure you have a subscription before doing all this. If you created a free account for the first time, you’ll already have a FREE TRIAL subscription for 1 month.
Step 2: Select Add.
Also Check: Our blog post on Azure Blob Storage. Click here
Step 3: Enter the following values:
- Subscription: Select your Azure subscription.
- Resource group: Enter a new resource group name.
- Virtual Machine name: It should be a unique name throughout the Azure network.
- Region: Select an Azure location, such as Western India, Central US, etc.
- Authentication Type: SSH Public Key
- SSH Public Key Source: Generate new key pair
- Select Inbound Ports: SSH (22), this is the port that we will be using to connect to our Virtual Ubuntu Machine.
- Select the Username and Key name as required and note them down as we will need them later.
- Once done, click on Next: Disks >
Also Check: Step by Step Instructions to install Azure Powershell Module. Click here
Step 4: Select the type of disk you want to use. Click Next.
Check Out: What is Azure Availability Zone? Click here
Step 5: Configure Networking
- Virtual Network: Create a new one or use your existing Network.
- Select Inbound Ports: SSH(22), This allows Port 22 to be opened in your Virtual Network for incoming traffic and will enable us to connect to our Virtual Machine inside our Virtual Network.
- Leave everything else as default and click next to go to the Management Section.
Also Read: Our previous blog post on Azure Kubernetes Service. Click here
Step 6: Management
Leave all options as default and click on next to go to the Advanced Section.
Step 7: Advanced Configuration
Add any custom data you want to run when the VM is being created or leave all options as default and click on next to go to the Tags Section.
Also Read: Our previous blog post on VM Scale Set Azure. Click here
Step 8: Tags Configuration
Add any descriptive tags you would like to put to identify your VM at a later stage or leave Options at default and click on next to review and create your Virtual Machine.
Step 9: Review your settings and make any changes if required and select Create. It takes a few seconds to create a VM.
Also Read: Azure Application Gateway vs Front Door: know their major differences!
Step 10: SSH Keys
- After you click on Create Azure will create an SSH Key Pair that we will be using to connect to our VM later. Make sure to download the private key and keep it somewhere safe.
- Azure does not store your private key and this is the only instance when you will be able to access your private key from Azure.
Also Read: What are the roles and responsibilities of an Azure Administrator Associate. Click here
Connecting to Ubuntu Virtual Machine
As we have configured our VM to be accessible via SSH we will be using the PuTTY SSH client on our Windows machine.
You can download and install PuTTY from its official website. Simply select Download Putty and choose the appropriate installation file (32-bit or 64-bit as per your system) from the choices shown.
Step 1: Converting our Private key into the proper extension.
The Azure private key we downloaded is in the (.pem) format, for using it with PuTTY we need to convert it into the (.ppk) format.
- Open PuTTYgen, an application automatically installed alongside PuTTY.
- Select load an existing private key. (make sure to select All files option while browsing to your Azure Key)
- You will get an Operation successful message if the key was imported correctly.
- Click on Save Private Key to save the key in a PuTTY usable format.
- you can optionally set a password to be used with this key for further security but for this tutorial, we will be skipping that.
Also Check: Az 104 Microsoft Azure Administrator: PDF Documentation & Tutorial. Click here
Step 2: Getting the SSH connection information.
- Go to the VM dashboard
- Select your VM
- Note the public IP address.
Note: every time the VM is restarted, this IP will be Different, unless you have an Elastic IP configured for your VM.
Also Read: Our blog post on Vnet Peering Azure. Click here
Step 3: Open the PuTTY installation on your Windows Machine.
- Enter the Host Name details in the following format: <Username of VM>@<Public IP of VM>
- Make sure Port is 22.
- The connection type is SSH.
Also Check az 104 vs az 103: to know the major differences between them.
Step 4: Inserting our SSH key for authentication.
- Expand the SSH option under Connection in the sidebar.
- Select Auth, Do not expand it.
- Leave all options at default settings and under private key file for authentication, browse to the Private Key we had created from PuTTYgen earlier.
- Click Open.
- Click yes in the security alert box to allow the remote connection.
If all the steps were done correctly then the connection will be successful and you will be logged into your Ubuntu Virtual Machine.
Reference/Related
- [AZ-900] Microsoft Azure: Resource Group, Resource Manager & ARM Template
- Azure Proximity Placement Groups | When To Use And What To Expect
- [AZ-104] Microsoft Azure Administrator Certification Exam: Everything You Need To Know
Next Task For You
Begin your journey toward Mastering Azure Cloud and landing high-paying jobs. Just click on the register now button on the below image to register for a Free Class on Mastering Azure Cloud: How to Build In-Demand Skills and Land High-Paying Jobs. This class will help you understand better, so you can choose the right career path and get a higher paying job.
Pavan kumar says
Great Explanation for beginners. Thank you very much
Rahul Dangayach says
Hi Pavan,
We are glad that you liked our blog!
Please stay tuned for more informative blogs like this.
Thanks & Regards
Rahul Dangayach
Team K21 Academy
George Mikros says
Great explalation . Thank you !!! . I was suffering, myself for hours to find out how can I connect to a linux machine on Azure. I am a windows person not used to ssh
Rahul Dangayach says
Hi George,
We are glad that you liked our blog!
Please stay tuned for more informative blogs like this.
Thanks & Regards
Rahul Dangayach
Team K21 Academy