Infrastructure-as-a-Service (IaaS) provides you with the on-demand computing infrastructure that can be provisioned and managed easily over the Internet. The key advantage of using IaaS is that it will eliminate CAPEX and OPEX costs for the organization. Azure’s IaaS services can be leveraged for scenarios such as:
- Hosting enterprise workloads
- Creating Test and Development environments
- For storage, backup and recovery options
- To host websites
- For big data analysis and HPC
azure virtual machine
Azure Virtual Machine (VM) allows IT professionals to provision a Windows or Linux based server in minutes. With Azure Virtual Machines, you get the flexibility of virtualization for a variety of computing solutions and support for Linux, Windows, SAP, Oracle, SQL Server, IBM, and more. Virtual Machines can be deployed from two models: ASM and ARM. However, deploying VMs in both the models have a few key differences.
When a VM is deployed in Azure Service Manager (ASM), there is a virtual container called Cloud Service around it, whereas the VM deployed in Azure Resource Manager (ARM) belongs to a particular Resource Group. Virtual machines of a similar kind can be deployed in a single cloud service. By default, in ASM, virtual machines deployed in the cloud service don’t have public IP address associated with them.
This isn’t the case in ARM since all the virtual machines in ARM have NIC attached to it which can have public IP address associated. In ASM, there is an option to deploy a VM quickly, without creating VNet and other dependencies. This is not possible with ARM deployments.
To know more in detail about ASM and ARM deployment models, have a look at guide “Understanding key differences between Azure ASM and Azure ARM“.
An ACTIVE Azure Subscription is required to provision a VM. In addition, a Resource Group, which can be created while provisioning a VM, is required. Other resources include a storage account to store VM disks, a virtual network with a subnet, a public IP address, and a security group.
SDKs and Other Tools
For a Windows based VM, Remote Desktop clients like Remmina (Ubuntu) or Remote Desktop Connection (Windows) are required. Here we will launch a Linux instance so any Linux CLI can be used to connect to the VM via SSH. SSH client like PuTTY can be used to SSH from Windows machines.
To get started with Virtual Machines from the Azure portal, navigate to portal.azure.com and enter your account credentials to log in. Click on New and then Compute and select Ubuntu Server 16.04 LTS.
On the next page, select Resource Manager from the Select a deployment model menu and click Create.
Configuring VM Basics
Enter an appropriate name for the VM. For the disk type, select HDD. Enter the username and for Authentication Type, we can proceed with Password authentication for simplicity, but the SSH public key option will be explained below. Select an appropriate Subscription. Under Resource Group, select Create New and enter a Resource Group Name. Select the Location to provision a VM.
Linux VMs support two types of authentication:
- Password authentication
- SSH key authentication
For SSH public key authentication, we have to provide a public key file which can be generated using the ssh-keygen command on Linux, or PuTTYGen on Windows. You can download PuTTYGen here.
To generate a public key and private key using PuTTYGen, follow these steps:
- Open PuTTYGen and click Generate. Make some random movements in the blank area using a mouse to create entropy.
- Save both Public key and Private key files:
- Copy the generated public key and paste it in VM Basics blade by selecting the SSH public key option
Choosing VM Size
- Basic Tier
- Standard Tier
Basic Tier VMs don’t support SSD storage or Load Balancing between VMs. There are also limited sizes available for Basic tier VMs. Standard tier supports Premium Storage (SSD) and Load Balancing.
For this guide, we will go with Standard D1_V2 size.
Configure Additional Resources
Various other resources like storage account, virtual network, IP Address, security group, etc. that support VM provisioning can be configured from this blade. Click on Storage account to choose an existing storage account (if any). Otherwise, leave the default settings as shown below.
Click on Virtual network. Choose an existing virtual network (if you have one). Otherwise, leave the default settings and save.
Leave the public IP address settings as it is. A Static IP can be allocated here. We will keep the IP assignment as Dynamic.
In Network Security Group, we will add one inbound rule for HTTP. Click on Add an inbound rule.
For the name, enter Allow-HTTP, set the Priority to 100 and from the Service menu, select HTTP. The Action should be set to Allow. Save these settings.
Leave other settings as default and click OK.
Validate VM Settings and Launch
On the Summary page, verify all the settings and click OK to start provisioning the VM.
Login to Ubuntu VM
Once the VM is up and running, the next task is to log in to the VM. We will use PuTTY from Windows to SSH into newly launched Ubuntu VM. PuTTY can be downloaded from here. Note down the Public IP of the Ubuntu VM.
Launch PuTTY. Enter the public IP of the VM in Host Name (or IP address) in PuTTY and click Open. For key based authentication, Private key (.ppk) can be selected from SSH > Auth option and select the .ppk file.
Accept the server’s host key configuration when asked in PuTTY. Enter your username and password in the PuTTY console to login.
Install Apache Web server
To install apache2 web server in Ubuntu machine enter the following command:
sudo apt-get install apache2
Once the installation is successful, navigate to the server’s IP address from the browser. You’ll see the following page:
Where to go next?
Deep dive into Azure with Linux Academy courses listed below: