1. Home
  2. Training Library
  3. Microsoft Azure
  4. Courses
  5. Getting Started with Azure Virtual Machines

Launching Your first Virtual Machine

Start course
Overview
Difficulty
Beginner
Duration
28m
Students
895
Description

Microsoft Azure is one of the key platforms currently serving the cloud computing market. Since its launch in 2010, it has quickly matured, adding whole categories of critical services, including the flagship "Azure Virtual Machines" - an IaaS computing platform.

In this course, our Azure expert Ganapathi Subramanian will introduce the Azure Virtual Machine service and its features, focusing on Azure Windows and Linux virtual machines using Azure portal and powershell scripts, creating and managing custom Azure virtual machine images, configuring Azure virtual machines for high availability, understanding Azure virtual machine networking features, and configuring Azure virtual machine for monitoring and auto-scaling.

If you're not yet familiar with the platform, you might gain by taking Ganapathi's Introduction to Microsoft Azure before starting this course.

Do you have questions on this course? Contact our cloud experts in our community forum.

Transcript

In this lecture we'll go over the process of creating Windows and Linux virtual machines. We will also cover how virtual machines can be created using PowerShell scripts. This diagram shows a high level architecture of Azure virtual machines. Azure virtual machines can be created using gallery images, which are pre-built images supported by Azure, or using a custom image built and uploaded by the user.

Azure supports various distributions of Windows and Linux operating systems like Ubuntu, CentOS, and SUSE. SQL servers, Sharepoint, and BizTalk gallery images are also supported by Azure. While using gallery images, Azure applies the corresponding license charges on top of the consumption charges. Users can bring their own licenses and use them by building custom images. The gallery and the custom images are stored as virtual hard disks, VHD in Azure storage. When a virtual machine image is launched, the Azure Hypervisor loads the VHD and spins up a virtual machine as part of the required configuration. Azure virtual machines can be created using the management portal, PowerShell scripts, or REST APIs.

Azure Virtual machines can be configured for load balancing during the launch process. Virtual machines can also be created within a virtual network during the launch process. Once created, Azure virtual machines can be accessed using remote desktop or SSH tools. Now let's go through a demo on how to create virtual machines in Azure. The first step in creating the virtual machine is to log into the Azure Management Portal.

Launch your first Azure Virtual Machine

For this demo, we'll use an existing Live account and subscription. After login to the portal select the virtual machines category and click the new option at the bottom of the screen. Virtual machines can be created from the image gallery, which are pre-built images provided by Azure, or custom images of those images have been uploaded into the storage. Let's create the virtual machine using the image gallery by selecting Windows 2012 Datacenter. As you can see, it allows creating Linux images too. The virtual machine create option prompts for many configuration details. But for this demo, we'll focus only on a couple of key configurations. Let's provide a unique name for the virtual machine, select the region for deployment, and user credentials that need to be used to access the virtual machines. Let's leave the rest of the configuration details as default.

Let's complete the virtual machine create wizard by clicking the complete button. This will kick off the provisioning process, which will take a few minutes to complete. After the virtual machine is provisioned, it can be accessed using remote desktop using the public internet IP, or private internet IP using VPN.

The user ID and password configured in the previous steps must be provided during login. After login to the virtual machine, it can be treated as any other on-premise server and configured for application use.

Azure Virtual machine's endpoint shows the default ports that are open to allow access. By default, PowerShell and remote desktop ports are opened. The dashboard also shows various details like the storage account associated with the virtual machine, URL, etc. Azure also supports creating Linux virtual machines.

Azure Virtual machines can be created using various Linux distributions like Ubuntu, CentOS, and SUSE. Let's go ahead and create a Linux virtual machine using the Azure Management Portal. After login to the portal click new in the virtual machines category. Select compute, virtual machine from gallery option to create the virtual machine. In the resulting image selection screen let's select the Ubuntu Linux distribution for this demo. Let's provide a name for the virtual machine, select the tier, size, and provide a username. For Linux VMs a certificate needs to be uploaded to allow SSH access.

We'll select the certificate and upload it. We will provide the password to log into the Linux VM and click on the next button. In the next screen we'll create a cloud service for the VM, a region for hosting the VM, a storage account, and availability set. Let's give a name to the availability set and leave the endpoints configuration as default. Click the next button which will take us to the next screen. We'll leave this page as-is and click on the complete button to start the virtual machine provisioning. The provisioning process will take a few minutes to complete. Once the provisioning is complete, we'll go to the dashboard tab and copy the SSH details to log into the Linux VM using PuTTy. Let's open the PuTTy tool and input the VM name for hostname.

Click on open to launch the VM. You will be prompted to enter the user ID and password. Let's enter the user ID and password configured in the previous screens. After successful login, the VM can be treated as any Linux server. We'll fire a few directory commands in the Linux VM. Let's complete the demo by logging out of the Linux VM.

Create Azure virtual machine using PowerShell

Azure PowerShell is a script environment that can be used to control and automate the deployment and management of tasks in Azure. Azure Cmdlets are script API supported by PowerShell for managing the resources in Azure. PowerShell tools and the SDK can be downloaded from the Microsoft site. The PowerShell environment supports Cmdlets reference with input and output parameters for easier implementation. Azure Cmdlets APIs need to be authenticated using Windows Azure Active Directory or management certificates before invoking them. Let's see how to use a PowerShell script to provision an Azure virtual machine. The first step while using a PowerShell script is to configure the management certificate for authentication. Let's use a self-signed certificate for this demo.

Self-signed certificates can be used using the makecert tool available in Windows. Once the management certificate is created it needs to be exported in .srv format, and uploaded to the Azure Management Portal. A management certificate establishes trust between the client computer and Azure for performing any tasks using PowerShell scripts. Here is a script which explains how to create a virtual machine using PowerShell. The first step in this script is to set the subscripition context on which all the tasks will be performed. Subscription context can be set to execute a sequence of command lists. Let's set the subscription content [audio skips 00:06:46] shown in the script. Once a subscription is set we can execute the Cmdlet to create a virtual machine. We'll use the Cmdlet to quickly create a virtual machine by passing on the details like type of os, service name, virtual machine name, user ID, password, and location to host the virtual machine.

Let's verify the virtual machine we've created using PowerShell by using the portal.

About the Author

Trevor Sullivan is a Microsoft MVP for Windows PowerShell, and enjoys working with cloud and automation technologies. As a strong, vocal veteran of the Microsoft-centric IT field since 2004, Trevor has developed open source projects, provided significant amounts of product feedback, authored a large variety of training resources, and presented at IT functions including worldwide user groups and conferences.