Azure Virtual Machines

Azure Virtual Machines

Study notes for AZ 300 certification for the topic “VMs”

These are notes from: edx Course: Microsoft Azure Virtual Machines

VM Series

VM Series

MS: Sizes


Ubantu: Enabling RDP

Set up Linux machine for RDP

sudo apt-get update
sudo apt-get install lxde
sudo apt-get install xrdp
echo startlxde > ~/ .xsession
sudo /etc/init.d/xrdp start

Enable RDP in Azure

Go to Settings/Networking, Add Inbound Rule: Custom/RDP/OK

Now you can use Windows RDP to remote into the Public IP of the Linux box

On- premises vs Azure VM

Creating VMs

MS Tutoria: Create VMl

Custom Images

Availability Sets

Availability set: Logical grouping of one or more vms. Has an Update Domain & an Fault Domain.

Availability Sets often used in conjunction with Scale Sets.

  1. Update Domain: Separate Azure Infrastructure Groups grouped by update cycle

    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.

  2. Fault Domain: Separate Azure Infrastructure groups grouped by hardware (example: server racks)

    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, a server rack serviced by a set of power or networking switches. VMs in an availability set are placed in at least two fault domains. This mitigates against the effects of hardware failures, network outages, power interruptions, or software updates.

MS: Availibility Sets

Assigning Availability Set to a VM

Scale Sets

MS: Scale Sets

Scale Sets are an Azure Compute resource 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 services targeting big compute, big data, and containerized workloads.

Scale set are often integrated with Azure Insight, Load Balancer and NAT rules. Azure Insight is used to measure when to scale up or scale down. The Load Balance and NAT rules work together to spread the workload over the available machines as they are added.

General guidance

Rest API Browser

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.

Channel 9 video with Scott Hanselman and David Ebbo.

Availability Sets Vs Scale Sets

From Stack Overflow

An availability set consists of a set of discrete VMs which have their own names and individual properties, but are spread across fault domains, which means when you have more than one VM in a set it reduces the chances of losing all your VMs in event of a hardware failure in the host or rack.

A scale set consists of a set of identically configured VMs, also spread across fault domains (in fact a scale set is an implicit availability set with 5 fault domains). The main difference is scale sets, being identical, make it very easy to add or remove VMs from the set while preserving high availability, which in turn makes it easy to implement autoscale, and to perform operations on the whole set or a subset of VMs. There are also API calls that support re-imaging and upgrading VMs, allowing you to roll out an update while keeping the service running. They are useful for cloud architectures which require deploying large numbers of similar VMs, or need to be elastic. A typical architecture might use a scale set for agent or worker nodes, and an availability set for master or control nodes. See for more detail.

Virtual Machine Storage

Candidates for Standard Storage

Compute centric apps. Examples: Webservers, Domain Controllers

Candidates for Premium Storage

Read write centric apps: SQL Sever, File System writing systems, batch services

Better storage Resiliency with Managed Disks

Unmanaged Disks: If you create a VM availability set and assign it to a VM, that VM will need a storage account, and you need to set up a corresponding number of availability sets for disk storage. (You don’t want to put all VHDs from multiple VMs in a single storage account in a single availability set, as that is a single point of failure). Hence you need multiple storage accounts in multiple Availability Sets.

Managed Disks: Every single storage account is in the same Fault Domain as the VM

Storage Spaces

MS: Storage Spaces

Storage Spaces is a technology in Windows and Windows Server that can help protect your data from drive failures. It is conceptually similar to RAID, implemented in software. You can use Storage Spaces to group three or more drives together into a storage pool and then use capacity from that pool to create Storage Spaces. These typically store extra copies of your data so if one of your drives fails, you still have an intact copy of your data. If you run low on capacity, just add more drives to the storage pool.

Create a Storage Pool (in VM Server Manager)

Create a Virtual Disk

Finally Create & Format the Volume

Now you have a new drive F which accumulates the individual disk storage on the Storage Space

Convert Unmanaged to Managed Disk

Scripts to convert Unmanaged to managed

  1. Deallocate the VM by using the Stop-AzVM cmdlet. The following example deallocates the VM named myVM in the resource group named myResourceGroup:

    $rgName = "myResourceGroup"
    $vmName = "myVM"
    Stop-AzVM -ResourceGroupName $rgName -Name $vmName -Force
  2. Convert the VM to managed disks by using the ConvertTo-AzVMManagedDisk cmdlet. The following process converts the previous VM, including the OS disk and any data disks, and starts the Virtual Machine:

    ConvertTo-AzVMManagedDisk -ResourceGroupName $rgName -VMName $vmName

Importing and Exporting Disks

Importing and Exporting Disks

If you want to move on-premises data to Azure Storage (or vice versa), there are a variety of ways to do this. One way is the Azure import and export service.

Azure Import/Export service is used to securely import large amounts of data to Azure Blob storage and Azure Files by shipping disk drives to an Azure datacenter. This service can also be used to transfer data from Azure Blob storage to disk drives and ship to your on-premises sites. Data from one or more disk drives can be imported either to Azure Blob storage or Azure Files.

Supply your own disk drives and transfer data with the Azure Import/Export service. You can also use disk drives supplied by Microsoft.

The Azure Import/Export Service allows you to:

This service is suitable in situations where you want to transfer several TBs of data to or from Azure, but uploading or downloading over the network is not feasible due to limited bandwidth or high network costs. Scenarios where this would be useful include: