How to Create a Microsoft Azure Linux Virtual Machine in Less Than Five (5) Minutes Using Custom Templates.
Introduction
Azure has a tool called Custom Templates which helps when it comes to deploying and managing infrastructure in the Cloud. These templates are blueprints that enables the User start and automate the creation of Azure resources. Leveraging on custom templates when deploying resources like Databases and Virtual Machines in Azure makes it quicker. We will explore how Custom Templates in Azure Resource Manager (ARM) simplifies the deployment of a Linux Virtual Machine in this blog post.
Imagine what a construction manager does for a building by taking the blueprint and builds, in this case we are referencing a digital infrastructure, the information provided in the custom template is what Azure Resource Manager (ARM) uses for its deployment.
As a preamble before going into our practical session of this writeup let us do the definition of Terms:
Templates
There are common Templates provided by Azure portal for Users to choose from, this saves a lot of time and effort in manually creating and configuring Azure resources such as a virtual machine, web App and SQL database
Template Source
The location in which you can find a template for deploying Azure resources is a Template source, they are specifically two types of template sources as listed below:
a) Quickstart templates
b) Template Specs.
a) Quickstart Templates
These are prebuilt templates that makes it easy to get started with deployment of resources in Azure, ready-made to allow customization that fits your specific requirements, they come as a convenient starting point by saving you time and effort for setting up your Azure resources from scratch.
b) Template Specs
This allow you to organize and manage your templates in Azure, making it easier to control how they are used and shared within your organization.
We are going into the blog proper now, so fasten your seat belt!
For this tutorial, we will create a Linux virtual machine with a custom template using the QuickStart template
1). Sign in to your Azure Portal
2). Type “Deploy a Custom template" in the search bar once it appears as below and press enter.
3). Click on Create a Linux virtual machine.
4). The Basics page will reflect your Linux virtual machine template.
PROJECT DETAILS
a) Your subscription is already picked “Azure Subscription 1”
Note here the arrow pointing down shows there can be more than a subscription available to choose from.
b). The Resource group is next. It is already picked here or you can create a new one if you wish.
INSTANCE DETAILS
a) The template selects a Region but you can choose to change it to another region.
b) Give your Admin Username a name
c) Select your Authentication type as Password for quick connection
d) Input the Admin password
e) Once Validation is Passed, click on the "Create" button.
f) Once Deployment is Complete, click on go to "Resource group"
This completes the creation of our Linux Virtual machine in less than 5 Minutes.
LET’S LEARN HOW WE CAN CONNECT WITH POWERSHELL
9). While inside the Resource group “martadrg” click “Access control (I AM)”
h). To connect to your Virtual Machine, click on "Connect" on the upper-left side of your virtual machine
i). At the interface below the Public IP address for the Virtual machine appears and two methods of connection as well choose “Native SSH”
In the diagram above Under Native SSH we have:
1. Configure Prerequisites for Native SSH
2.Open Local Shell on Windows
3. Copy and Execute SSH command. and
4. Run the example Command below to connect to your VM (inadvertently not captured here)
showing [ssh-i<PrivateKey Path>martinsadvisory@20.82.7.148]. You are to create a new formular deleting entire private key path to connect to your VM using Powershell as below:
ssh username@ipaddress
ssh.martinsadvisory@20.82.7.148
Notice another IP address was used above, the real is 40.68.212.168. This is because the VM had already been deleted at the time of this publication.
At this Juncture your launch PowerShell on your desktop and put the command above and press enter.
You would be asked if you want to continue connecting, type "yes" and press enter
I hope you learnt a lot here which am sure you did. Subscribe to my newsletter so you can be informed about my next post.