Azure Virtual Machines

What are IaaS Cloud Services?

Infrastructure as a service (IaaS) is an instant computing infrastructure, provisioned and managed over the internet. Quickly scale up and scale down with demand, and pay only for what you use.

1

There are lots of business scenarios for IaaS.

  • Test and development: Teams can quickly set up and dismantle test and development environments, brining new applications to market faster. IaaS makes it quick and economical to scale up dev-test environments up and down.
  • Website hosting: Running websites using IaaS can be less expensive than traditional web hosting.
  • Storage, backup, and recovery: Organizations avoid the capital outlay for storage and complexity of storage management, which typically requires a skilled staff to manage data and meet legal and compliance requirements. IaaS is useful for handling unpredictable demand and steadily growing storage needs. It can also simplify planning and management of backup and recovery systems.
  • Web apps: IaaS provides all the infrastructure to support web apps, including storage, web and application servers, and networking resources. Organizations can quickly deploy web apps on IaaS and easily scale infrastructure up and down when demand for the apps is unpredictable.
  • High-performance computing: High-performance computing (HPC) on supercomputers, computer grids, or computer clusters helps solve complex problems involving millions of variables calculations. Examples include earthquake and protein folding simulations, climate and weather predictions, financial modeling, and evaluating product design.
  • Big data analysis: Big data is a popular term for massive data sets that contain potentially valuable patterns, trends, and associations. Mining data sets to locate or tease out these hidden patterns requires a huge amount of processing power, which IaaS economically provides.

What are Virtual Machines?

Azure Virtual Machines is one of several types of on-demand, scalable computing resources that Azure offers. Typically, you’ll choose a virtual machine if you need more control over the computing environment than the choices such as App service or Cloud Services offer. Azure Virtual Machines provide you with an operating system, storage, and networking capabilities and can run a wide range of applications.

2

An Azure virtual machine gives you the flexibility of virtualization without having to buy and maintain the physical hardware that runs the virtual machine. However, you still need to maintain the virtual machine – configure, patching, and maintaining the software that runs on the virtual machine.

Examples of when to use virtual machines

  • Test and Development: Virtual machines provide a quick and easy way to create different operating system and application configurations. Test and Development can then easily delete the VMs when they are no longer needed.
  • Running applications in the cloud: The ability to run certain applications in the public cloud as opposed to creating a traditional infrastructure to run those applications can provide substantial economic benefits. For example, if an application needs to handle fluctuations in demand, being able to shut VMs down when you don’t need them or quickly start them up to meet a sudden increased demand means you only pay for the resources you are using.
  • Extending your data center to the cloud: An organization can extend the capabilities of its own on-premises network by creating a virtual network (VNET) in Azure and adding VMs to that VNET. Applications like SharePoint can then run on an Azure VM instead of running locally, making it easier to deploy or less expensive to do so than in an on-premises environment.
  • Disaster recovery: Similar to running certain types of applications in the cloud and extending an on-premises network to the cloud, you can use an IaaS-based approach to disaster recovery, and obtain significant costs savings. If a primary datacenter fails, you can create the VMs running on Azure to run your critical applications, then shutdown when the primary datacenter is once more operational.

Comparing On-Premise vs. Azure Virtual Machines

3

Now, for most administrators, this is where the biggest difference becomes. There’s differences in the way they’re configured and differences in the way you manage them.

The single biggest thing, that I think most administrators get uncomfortable with this notation, that within Azure, there is no console access to a virtual machine. This is both a security and design point and also a point of ensuring, that no else can get access to anything and no one else can see what’s going on your VM. The only way you get console access is if you run on Hyper-V. Within Azure, it’s RDP access only. If you’re creating a virtual machine on Hyper-V, it is be a Generation 1, or it can’t migrate to Azure. If you require a Generation 2 virtual machine, Hyper-V’s going to be your solution. Azure doesn’t support the VHDX file format. It’s not a big deal you can run a simple PowerShell command and you can convert any VHDX to VHD and stick it in Azure. So, the file format is not an issue. Upgrade to the guest operating system, within Azure is not supported. You would deploy a different version of the operating system. Many VMs support multiple network adapters. When you’re deploying a virtual machine, you’ve got to choose a size that supports more than one NIC.

Identifying workloads for Azure VMs

Suitable workloads for Microsoft Azure IaaS VMs

There are certain types of workloads that are a better fit for hosting in an Azure IaaS environment than others. Here are some examples:

  • Highly available service workloads such as commercial online stores.
  • Unpredictable growth workloads like those experienced by small, but rapidly expanding organizations, or short-term increased sales of fad items.
  • Spiking workloads, such as those experienced by sites providing news services.
  • Steady workloads scenarios where organizations simply want to offload their infrastructure to the cloud.
  • Periodic workloads such as retail sales spurts during holidays.

Workloads that are not suitable for Microsoft Azure IaaS VMs

When planning virtual machines workloads for Azure IaaS, it is also important to remember that not every application or service is a suitable fit for the cloud. Here are some examples.

  • Low volume or limited growth workloads where the organizations might be able to run the service or application on commodity hardware on premise less expensive than in the cloud.
  • Regulated environment workloads where an organization, or even the local government, may regulate the type of data that can be hosted in the cloud. However, these cases might be suitable candidates for a hybrid solution where only some highly available data is hosted in Azure and more sensitive, regulated data is kept on-premises.

What Virtual Machines Sizes are Available?

You can configure virtual machines with a variety of options for CPU, memory, and IOPS. The windows virtual machines sizes consists of several series: A-series, D-series, F-series, and G-series. When your requirements change, it is easy to resize the VM.

Type

Sizes

Description

General Purpose DSv2, Dv2, DS, D, Av2, A0-7 Balanced CPU-to-memory ratio. Ideal for testing and development, small to medium databases, and low to medium traffic web servers.
Compute Optimized Fs, F High CPU-to-memory ratio. Good for medium traffic web servers, network appliances, batch processes, and application servers.
Memory Optimized GS, G, DSv2, DS High memory-to-core ratio. Great for relational database servers, medium to large caches, and in-memory analytics.
Storage Optimized Ls High disk throughput and IO. Ideal for Big Data, SQL, and NoSQL databases.
GPU NV, NC Specialized virtual machines targeted for heavy graphic rendering and video editing. Available with single or multiple GPUs.
High Performance Compute H, A8-11 Our fastest and most powerful CPU virtual machines with optional high-throughput network interfaces (RDMA).

Pricing considerations

One of the main planning factors with any cloud-based service is not so much the availability of resources, but the price that an organization is willing to pay for those resources.

To help with estimating the potential costs when planning for virtual machines in Microsoft Azure, you can use.

The online pricing calculator tool enables you to cost out different workloads and services in Microsoft Azure.

4

The Azure TCO Calculator estimates the cost savings you can realize by migrating your application workloads to Microsoft Azure.

5

Supported Software and Scenarios

Microsoft server software Support

All software that’s installed in the Azure virtual machine environment must be licensed correctly as per in an on-premises deployment. By default, Azure virtual machines include a license for many common products including windows server (selected roles and features), Microsoft Exchange, Microsoft SQL Server, and Microsoft SharePoint Server. The Microsoft server software support for Microsoft Azure Virtual Machines page lists the current supported products and versions.

Notice also that not all software roles and features are supported. For example with Windows Server, Hyper-V, WDS and some other roles are not supported, and Multipath I/O, Network Load Balancing features, to mention just a couple, are also not currently supported.

Linux support -Endorsed and Non-Endorsed versions of Linux

Microsoft Endorsed Linux images are available via the Azure Gallery or the Azure Marketplace. These Microsoft Azure endorsed versions of Linux are created and published by Linux providers and Microsoft is continually working with Linux partners to add more versions to the available list.

Note

  • Customers are welcome to bring their own distributions of Linux into Azure, but we encourage them to use an Endorsed Linux distribution, as they are maintained by some of the most well-known Linux vendors in the world.
  • Each Linux vendor may offer a different service level agreement for responding to cases outside of Microsoft Control.

Access and optimize

Access

The Azure Virtual Machine Readiness Assessment tool will automatically inspect your on-premises environment, whether it is physical or virtualized, and provide you with a check list and detailed report on steps you need to access you environment for its readiness to move to the cloud.

6

Optimize

The Microsoft Azure Virtual Machine Optimization Assessment provides prioritized recommendations across six focus areas to optimize your experience while running in Azure. After a short questionnaire, automated data collection and analysis, a custom report is generated. This report includes a executive summary, key and detail recommendations which provide a high level view across the focus areas to help you manage, prioritize, and implement the recommendations.

7

Microsoft does not support an upgrade of the operating system of a Microsoft Azure virtual machine. Instead, you should create a new Azure virtual machine that is running the supported version of the operating system that is required and then migrate the workload.

Methods of Creating Virtual Machines

Azure offers different ways to create a virtual machine because virtual machines are suited for different users and purposes. This means that you need to make some choices about the virtual machine and how you will create it. Azure Documentation provides simple tutorials that let you walk through some of the different ways to create virtual machines. This section provides links to those tutorials in case you want to try them for yourself.

Azure portal

Using the Azure portal is a simple way to try out a virtual machine, especially if you’re just starting out with Azure. Click the following link to see the tutorial for how to create a virtual machine running windows by using the portal, connect to the virtual machine, and then stop the virtual machine.

Template

Virtual machines require a combination of resources (such as a availability sets and storage accounts). Rather than deploying and managing each resource separately, you can create an Azure resource Manager template that deploys and provisions all of the resources in a single, coordinated operation.

Azure PowerShell

You can use Azure PowerShell running on windows, Linux or MacOS to perform many of the same tasks in Azure as you would with the portal, such as creating and configuring cloud services, virtual machines, virtual networks, and web apps. Azure PowerShell is a set of modules that provides cmdlets to manage Azure with windows PowerShell, providing you with a lot more and flexibility to test, deploy, and manage solutions and services delivered through the Azure platform.

Azure CLI

If you are familiar with and have a preference for working in a command line shell you can use the Azure CLI installed on a windows, a Mac or Linux computer to deploy a virtual machine in Azure.

 

Visual Studio

Developers often need a way to quickly set up a development machine with a particular configuration in order to build, manage, and deploy cloud apps and services. Azure now provides series of preloaded VM images with visual studio, Azure SDK and tools, windows server, or windows client (MSDN Only). This saves a lot time because the developer doesn’t need to spend hours setting up a lab environment and just uses the virtual machine or machines as long as is needed.

Creating Virtual Machines from the Marketplace

Azure provides a large image gallery in the Marketplace. The gallery includes recent operating system images of windows server, Linux, and SQL server. You can also store your own images in Azure, by capturing an existing virtual machine and uploading the image.

8

Creating Virtual Machines (Portal)

There are two main methods for deploying virtual machines. each method has its own capabilities and options that can be configured.

No matter what method you use, these are the basic steps for deploying a virtual machine.

9

  1. Select an image or disk to use for your new virtual machine.
  2. Provide required information such as host name, user name, and password for the new virtual machine.
  3. Provide optional information like domain membership, virtual networks, storage account, cloud service, and availability set.
  4. Provision the machine.

For quick access, you can pin your virtual machine to the starboard, and can unpin them if no longer needed.

Resource Manager Templates

Creating a virtual machine with a Azure Resource Manager template is another way to quickly create a virtual machine.

10

  1. You can create your own template using the information found in Authorizing Azure Resource Manager templates. You can deploy templates that have been created for you from Azure Quick start templates. The template file can be created with a simple text editor and the file type is JSON.
  2. To specify values for the resource parameters that were defined in the template, you create a parameters file. This is also a JSON file type.
  3. All resources, like virtual machines, must be part of a resource group.
  4. Once the template and resource files are ready, you can use the New-AzureRmResourceGroupDeployment cmdlet to implement your resource. You cloud also use azure CLI using a command such as az group deployment create.

Don’t forget to properly secure any username and password parameters that are included in the JSON files. Remember you can always use Azure CLI as an alternative to any PowerShell cmdlets to achieve the same results when interacting with Azure.

Linux Virtual Machines

Azure Marketplace includes a large number of Linux virtual machines. Here are just a few.

12

Linux has the same deployment options as for windows virtual machines: PowerShell (classic and Resource Manager), portal, and Command Line Interface.

Bash on Windows

A common problem encountered is how to easily manage Linux virtual machines from windows environments. There are several options and additional toolsets you can use such as Cygwin, Git for windows etc but with windows 10, it is now possible to run a Linux Bash natively on windows and run the same binaries and commands that you would run in a Linux environment, from your windows 10 host machine.

Bash on windows allows you to do the following:

  • Run the command line utilities such as grep, sed, awk
  • Use the Linux-compatible filesystem & hierarchy and access fixed windows storage mounted under /mnt/..
  • Run Bash Shell scripts and Linux command line apps including
    • Tools: vim, emacs, tmux.
    • Languages: JavaScript/node.js, Ruby, Python, C/C++, C# & F#, Rust, Go etc
    • Services: sshd, MySQL, Apache, lighttpd.
  • Install additional Linux tools under apt
  • Invoke windows applications from within Bash
  • Invoke Linux applications from within Windows.

Installing Bash on Windows

To run Bash on Windows you need to do the following

  1. Turn on Developer mode via settings > update and security > For Developers
  2. Bash in Windows is enabled by adding the windows feature Windows Subsystem for Linux (beta), as shown in the below screenshot.

11

3. You will need to restart and you should also be aware that is currently still in beta.

You can also enable it via PowerShell using the command Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux.

Accessing Bash on Windows

Once installed you can access Bash on windows by the following

  1. Launch the command line and run the command Bash to enter the Linux subsystem.
  2. Via the Start Menu and selecting Bash on Ubuntu on Windows.

Below is a screenshot of the Linux Bash on Windows and some commands that have been run with their resultant output.

13

Generating SSH keys for connecting to Linux VMs

When connecting to Linux virtual machines via SSH you will need to create public and private keys and create a secure shell (SSH) tunnel from the host to the Linux virtual machine on Azure. Azure requires at least a 2048-bit key length and the ssh-rsa format for public and private keys. There are several options available for creating those keys.

Connecting from Windows you can use the following:

  1. PuTTy gen to create the keys and PuTTY Configuration to configure and create the SSH connection. It is available for download from the org site.
  2. Bash on Windows and the ssh-keygen command to generate the keys and ssh to make the connection. This is available natively on Windows 10.
  3. Some other Linux packages which contain an SSH client are Cygwin, Git for windows, which can be installed on Windows and can also be used to generate keys and connect to and connect to a Linux VM.
  4. Create directly in your ARM Deployment template.
  5. For some applications there may be a switch option that you can use to generate keys automatically as part of a deployment. For example in the container service, you can use Azure CLI 2.0 which you can install on windows, Linux or Mac and use the switch –generate-ssh-keys, when running the az acs create command to generate keys when creating container cluster.

Connecting from Linux or Mac you can use the following:

  1. Ssh-keygen, which is available natively in Linux or Mac, to create the keys and the ssh command, which is also available natively in both Linux and Mac, to make the connection.
  2. Directly in an Azure template.

Note as well that keys generated with PuTTY can have a slightly different format than those created by ssh-keygen. If we look at the message that we see in Azure when assigning an SSH key, it says, Provide an RSA public key in the single-line format (starting with “ssh-rsa”) or the multi-line PEM format. You can general SSH keys using ssh-keygen on Linux and OS X, or PuTTYGen on Windows. It is displayed as per the below,

14

Keys created by Linux based tools will also have the default naming convention of id_rsa and id_rsa.pub, and be stored in a default locations, typically $Home/.ssh/. If you do not have the keys in the default locations you will need to be able to specify the location when running commands where the keys are required.

This is just something to be aware of if you encounter connectivity issues i.e., be aware of the key format, key names and locations.

Demo creating Public Private Key pair using PuTTY on Windows

  1. Download and run PuTTYgen from the following location:

http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

  1. Click on menu: File > Load Private Key
  2. The public key is displayed at the top of the PuTTYgen You copy and paste this public key into the Azure portal or Azure Resource Manager template when you create a Linux VM. You can also click Save public key to save a copy to your computer.

15

4. Save public key

5. Enter a name and location to save your PPK file.

Availability sets

As an Azure administrator you must be prepared for planned (updates) and unplanned (hardware) failures. One way to prepare is with availability sets. An availability set is a logical grouping of two or more virtual machines.

When creating Availability sets keep these principles in mind.

  • For redundancy, configure multiple virtual machines in an availability set.
  • Configure each application tier into separate Availability sets.
  • Combine a Load Balancer with Availability sets.

A service level agreement (SLA) is in place for availability sets.

  • For all virtual machines that have two or more instances deployed in the same Availability set, Microsoft guarantees you will have virtual machine connectivity to at least one instance at least 99.95% of the time.
  • For any single instance Virtual Machine using premium storage for all disks, Microsoft guarantees you will have Virtual Machine Connectivity of at least 99.9%.

Each virtual machine in an availability set is placed in one update domain and two fault domains.

Update and Fault Domains

What are Update and Fault Domains?

16

Each virtual machine in an availability set is automatically assigned an update Domain and a Fault Domain. This assignment helps Azure maintain high availability and fault tolerance when deploying and upgrading applications.

Update Domains

An update domain allows Azure to perform incremental or rolling upgrades across a deployment. Each update domain contains a set of virtual machines and associated physical hardware that can be updated and rebooted at the same time. During planned maintenance, only one update domain is rebooted at a time. By default there are five update domains, but you configure up to twenty update domains.

Fault Domains

A Fault domain defines a group of virtual machines that share a common set of hardware, switches, and more that share a single point of failure. For example, each rack serviced by a set of power or networking switches. VMs in an availability set are placed in at least two fault domains. This migrates against the effects of hardware failures, network outages, power interruptions, or software updates.

Scale Sets

What are Scale Sets?

Virtual machine scale sets are an Azure compute resources you can use to deploy and manage a set of identical VMs. With all VMs configured the same, VM scale sets are designed to support true auto-scale no pre-provisioning of VMs is required – and as such makes it easier to build large-scale targeting big compute, big data, and containerized workloads.

17

General guidance

  1. You can create both Linux and windows VM scale sets from the Azure Portal. These scale sets are automatically created with load balancer NAT rules to enable SSH or RDP connections.
  2. A scale set can vary between 0 and 100 VMs and it is a simple call to change the number of virtual machines.
  3. You can set the maximum, minimum and default number of VMs, and define triggers -action rules based on resource consumption.
  4. When you increase the number of virtual machines in a scale set, VMs are balanced across update and fault domains to ensure, maximum availability. Similarly when you scale in, VMs are removed with maximum availability in mind.

Azure Resource Explorer

What is Azure Resource Explorer?

Azure Resource Explorer is a great tool to view and modify resources you have created in your subscription. The tool is web-based and uses your Azure portal logon credentials. The source for the Resource Explorer tool is available on GitHub, which provides a valuable reference if you need to implement similar behavior in your own applications.

This tool is particularly useful in viewing Azure scale sets. With the tool you can see the individual virtual machines and their properties.

19

 

Leave a comment