Introduction
In this article, we will explore what a Virtual Machine is, along with the step by step implementation and the ways of connecting VMs to our local system.
Virtual Machines Service in Azure provides a highly flexible "compute on demand" option for running our application workloads. The Azure portal provides a large collection of templates from which we can get started with our desired server and operating system. We can create multiple virtual machines and group them together in Azure cloud services. Cloud services serve as a network and security boundary for virtual machines. By placing virtual machines in cloud service, we can create multiple instances of any tier of our application. For example, we host our web application on three virtual machines having the same server operating system and place those virtual machines in an availability set so that at least one virtual machine will be available at all the times. Virtual machines use the Hyper-V virtual hard disk format (.vhd) for their hard drives. We can simply upload the fixed-size virtual hard disk files from our infrastructure to Azure and also download the hard disk files from Azure to our data center.
Let's create a Virtual Machine through the portal.
Log into portal.azure.com and click on "Virtual machines".
Click on 'Add', which will open the "Create a virtual machine" wizard.
- Select your Azure subscription. Duly note that all resources in an Azure subscription are billed together.
- Select existing or create a new resource group. It is a collection of resources that share the same lifecycle, permissions, and policies.
- Provide your virtual machine a name. For demo purpose, I have given it a name like 'MyFirstVM'.
- Select the region that is right for you and your customers. Not all VM sizes are available in all regions.
- Azure offers a range of options for managing the availability and resiliency of your application. We can select 'Availability Set' also but as of now, select 'No infrastructure redundancy required'.
- Choose the base operating system or application for your VM.
- Change the size as per your requirement and the price will be calculated accordingly.
- Provide Username and Password which will be used later on to connect your VM.
- Inbound Port Rules can be added later on. As of now, select 'None'.
- Select 'No' for a Windows license.
- Select your disk option.
- Premium SSD
Offers high-performance, low-latency disk support for I/O-intensive applications and production workloads.
- Standard SSD
Cost effective storage option optimized for workloads that needs consistent performance at lower IOPS (Input/Output Operations Per Second) levels.
- Standard HDD
For dev/test scenarios and less critical workloads at the lowest cost.
- For best performance, reliability, scalability, and access control, it is recommended to select Managed Disk for most of the virtual machine configuration. Use unmanaged disks if you need to support certain classic scenarios or want to manage Disk VHDs in your own storage account.
- Keep the networking option as it is and move to Management.
- Boot the diagnostics capture serial console output and screenshots of the virtual machine running on a host to help diagnose startup issues.
- OS guest diagnostics gets metrics every minute for our virtual machine. We can use them to create alerts and stay informed on our applications.
- Metrics are written on a storage account.
- If Identity is enabled, all necessary permissions can be granted via Azure Role-based access control.
- Enable auto-shutdown configures our virtual machine to automatically shut down daily.
- Provide the time when we want to shutdown VM
- Provide the time zone in which shutdown time is given
- Subscribe for notification before the VM is shutdown
- To guard our VM against accidental deletion and corruption, enable backup.
- Add extensions like antivirus protection for our VM.
- A tag is not required as of now. Skip this stage and move to Review + Create.
- It will validate all the inputs and show the status message.
- Click on the 'Create' button.
Once the VM is created, you will be able to see the deployment details as below.
Now, in the next step, let's try to connect our recently created VM. For this, we need a public IP Address and port or we can download the RDP file directly.
- Click on 'MyFirstVM' resource.
- Click on 'Connect'.
- Click on 'Download RDP File' button.
You will get the file as below in your local system.
Now, if you try to connect VM using the above RDP file, it will throw an exception. By default, all the inbound ports are blocked. We need to add a new rule to enable the particular port.
Explore the 'Networking' option under Settings.
Click the 'Add Inbound port rule' button.
Input 3389 as the destination port ranges and keep the rest of other options as they are.
Click on the 'Add' button.
Once the inbound port is added, try again to connect to the VM. It will ask for credentials.
Insert the credentials which we have given at the time of VM creation.
Connecting…
It will give warnings for Certificate but as of now, you can click on 'Yes' button and continue.
We are successfully able to connect our VM.
We can monitor our VM CPU, Network, and Disk details as well as Start and Stop VM as per our requirement.