Azure Managed vs Unmanaged disks : The choice

Hi folks,

Recently (few months) , a new feature was announced to bring a new capability to Azure Virtual Machines : Azure Managed Disks.

Many blog posts explain well the purpose of managed disks, and how they bring enhancements to Azure IaaS virtual machines. I recommend the following readings :

The latter post shows the advantages of using Azure Managed disks, which I agree and confirm. But on the meanwhile, there is some ‘inflexible’ properties of managed disks, that may not be suitable for your or for your expectations. This is the purpose of this post : What is the model that fits my requirements , Managed or unmanaged disks.

1- The main difference between Managed disks and Storage Accounts based disks

There are some main differences between managed and unmanaged disks :

Category

Managed disks

Unmanaged disks

Management

Is an ARM (Azure Resource Manager) object (resource) Is not an ARM resource, but a file (.vhd) residing on a Azure Storage Account. The latter is an ARM  object

Size

The managed disks sizes are fixed (and can be resized). Which means that you cannot choose a custom size. You will need to pick up from a list. See (1) You can choose the disk size during the provisioning (and can be resized) when using Standard Storage. See (2)

Cost

You will pay :

·       Standard Storage :

o   A fixed price per disk size (Per month), whatever the disk usage is

o   Operations cost*

·       Premium Storage

o   A fixed price per disk size whatever the disk usage is

See (1)

You will pay :

·       Standard Storage :

o   The GB / month disk usage. You pay only what you consume

o   Operations cost*

·       Premium Storage

o   A fixed price per disk size whatever the disk usage is

See (3) and (4)

Performance

A managed disk have a predictable performance, with Standard storage (500 IOPS) or Premium storage (Depends on the disk). Only premium storage disks have a predictable performance (depends on the disk). Standard storage have a predictable performance (500 IOPS) unless they are impacted by the Storage Account performance limits (A maximum of 40 disks per standard storage account is recommended, otherwise disks can be throttled). See (5)

Availability

When placing VMs using managed disks under an Availability Set, disks are placed on different fault domains in order to achieve the better SLA (The Availability Set SLA is only for compute) When placing VMs using unmanaged disks under an Availability Set, there is no guarantee that the disks are placed on different fault domains, even if they are on different Storage Accounts.

Redundancy

LRS LRS, GRS

Encryption

ADE, SSE (Coming soon) ADE, SSE

* Operations cost means : Replication data transfer cost (In case of GRS) + Storage operations costs

 

2- Are managed disks more expensive that unmanaged disks ?

The answer is : It depends, but except in some cases, managed disks are always more expensive than unmanaged disks. Let’s prove it :

Standard Storage managed disk cost per month

  • Managed disk cost = Fixed Cost (Per disk size) + Operations cost
  • Unmanaged disk cost = Storage_Usage_In_GB * CostperGB + Operations cost

Because the Operations cost is the same for both models, we will omit them during calculation. Because the managed disk pricing model is not per usage, we will calculate the Disk size equity* value, to be able to compare with unmanaged disk :

Managed disk type

Size (GB) Price Cost per GB Standard Storage price per GB Disk size equity*

S4

32 1.3 0.040625 0.0422 31

S6

64

2.54

0.0396875

60

S10

128

4.98

0.03890625

118

S20

512

18.36

0.035859375

435

S30 1024 34.56

0.03375

818

* If you use less than the given size, then Unmanaged disks will cost less than managed disks. If you use more, then managed disks cost will be less than unmanaged disks. The €/GB will be greater as long you consume less storage space.

NB : New disk sizes have been announced (6) that finally make and end for the 1 TB disk size limit, with 2 and 4 TB for managed disks, and up to 4 TB for unmanaged disks. The service started on the West US Central region and will be generalized for the remaining regions during the coming months

3- Do I really need managed disks ?

This is a good question, but the answer is very relative to your needs. As you probably have read on the posts I mentioned earlier in this post, there are many benefits of using managed disks:

  • Disk snapshots
  • Predictable performance
  • Distribution in different fault domains when associated with Availability Sets
  • ARM object

Some workarounds may be used to have similar properties with unmanaged disks:

Properties

Unmanaged disk workaround

Disk snapshots

 

No workarounds

Predictable performance

 

Place less than 40 disks per Storage Account

Distribution in different fault domains when associated with Availability Sets

 

No Workaround. There is no way to know if the disks are place on different pools even if they are on different Storage Accounts

ARM object

 

Place each disk on its own Storage Account. Look if this will fit your needs  (Do not forget quotas)

 

4- Verdict

As you can see, managed disks brought new experience and features to Azure VM storage that permits better controlling the VM storage. Personally, I would recommend using managed disks, even if the ‘Pay as you consume’ model is not adopted there. But the features and the simplicity is worth the ‘little’ difference we can see with pricing.  Continue reading

Azure Backup for Iaas V2 released on Public Preview

Update 2 : MS just confirmed me (but not published) that Azure Site Recovery is supported via the new portal, via Recovery Services

Update : MS released the official documents, I was just announcing here Smile

https://azure.microsoft.com/en-us/documentation/articles/backup-azure-vms-first-look-arm/

Great news for Azure IaaS V2 users (ARM). Yesterday, Microsoft announced the release of the Public Preview of Azure Backup for IaaS V2 via ‘Recovery Services Vaults’

This is a quick step be step to rapidly configure your VMs backup

NB : Azure Backup via Recovery Services Vaults will let you backup V1 and V2 VMs (Classic and ARM). It’s recommended that you will use it just to get your hands on and not for Production, since it’s not covered by any SLA or commitment (Preview). MS has not published guides to migrate existing Backup vaults to Recovery Services Vaults, but I think this is planned.

Let’s start:

Login to the Azure Portal (https://portal.azure.com). Go to Browse –> Recovery Services vaults

0923

Click the Add + button

0924

Type a Name for the RS vault, choose a Subscription, a Resource Group and a Region. You need to know that the Recovery Services vault in tied to a Region. you cannot Backup/Restore resources to/from a different region.

0925

After the vault creation. you can discover the different options available. Just for Information : Recovery Services Vaults include Azure Backup services (VMs, Files, SCDPM) and ASR (Azure Site Recovery). ASR is currently on Private Preview and is not yet released. File and SCDP support we come soon too.

To configure a Backup, click on Backup +

0926

Select the Backup type. As mentioned, only Azure Virtual Machine Backup is supported by now

0927

You will now choose the Backup Policy. You can select an existing policy or create a new one.

0928

The policy have the following options:

Name : Type a Name for your policy (Class1, Class2, Class3). Just a recommendation, Do not make naming like ‘Daily’ or ‘weekly’ since the retention may differ for two ‘daily’ based policies

Backup Frequency : There are only two options and a start hour. You can make Daily Backups or Weekly backups

Retention : This is great about Azure Backup since on the same policy you can configure your retention and  long term retention (Daily, Weekly, Monthly and Yearly!!)

0929

Once the Policy is selected, you can choose which Virtual Machines to backup with this Policy. Note that Classic VMs and ARM VMs can be backed up with the same policy.

0930

You can verify that the VMs selected are under the Backup Items blade, in addition to some other information like the Last Backup status, the Policy…

0931

On the Backup Jobs Blade, you can find all the Backup Jobs of all VMs. You can change the period using the Filter Button

0932

This just a teaser, more is coming, try it, you can ask me question on the comments, but as a reminder:

  • Do not use on Production, wait for the GA (Maybe 2 months)
  • ASR is not supported yet
  • A lot of enhancements are coming (User Experience mainly), stay tuned

Add or change an ARM Virtual Machine’s Availability Set

Hi all,

One of the limitations we may encounter when dealing with Azure ARM Virtual Machines is the ability to manipulate the VM’s availability Set configuration after the VM deployment. In fact :

  • You can’t change the VM’s Availability Set once the VM is created
  • You can’t add an Azure VM to an Availability Set once the VM is created
  • You can’t remove a VM from an Availability Set

This is a big limitation since we may need such feature, in different cases:

  • We need to add an existing VM to a highly available pool
  • We want to change the Availability Set name
  • We messed up with the Availability Set  naming

I think this feature will come in the future, but the far or the near future, I have no idea. Maybe by the end of the year (Q4 !)

Till that time, I wrote this Powershell script, which will enable you to manage an ARM VM’s availability Set

Features

  • Add a VM to an Availability Set
  • Change a VM’s Availability Set
  • Remove a VM from an Availability Set

How it works ?

The script will:

  1. Get the VM configuration
  2. Save it to a local location (If something goes wrong, we can recreate the VM)
  3. Remove the VM (Only the configuration, all related objects are kept)
  4. Create a new  VM configuration with the AS config (Add AS, Remove AS, Change AS)
  5. Recreate the VM

How to use it ?

1- Download the script and save it to local location

2- Run it and provide the requested parameters

or

2- ./Set-ArmVmAvailabilitySet.ps1 –VmName ‘The VM Name’ –ResourceGroup ‘Resource Group’ –AvailabilitySetName ‘As Name’ –SubscriptionName  ‘The Subscription name’

 

To remove a VM from an AvailabilitySet:

./Set-ArmVmAvailabilitySet.ps1 –VmName ‘The VM Name’ –ResourceGroup ‘Resource Group’ –AvailabilitySetName 0 –SubscriptionName  ‘The Subscription name’

 

 

Download Link

Version 1.01 : https://gallery.technet.microsoft.com/Set-Azure-Resource-Manager-f7509ec4

Version 1.0 : (Retired)

How to create a Multiple NIC Azure Virtual Machine (ARM)

Hi all,

A lot of people asked me to write a short post of how to create an Azure Virtual Machine with multiple NICs. After some googling an binging, I was not able to find a blog or an article which explains how to achieve it in a simple manner. And here we are !

I- Considerations and requirements

To be able to create a multiple NIC ARM virtual machine, the next requirements should be respected :

  • Not all the virtual machines sizes support multiple NICs. Check if your VM size is supported ( https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-size-specs/)
  • The Virtual NICs must be connected to Subnets within the same VNET. You cannot deploy a VM on multiple VNETs
  • You can use Azure CLI, Azure API or Powershell to make this operation. The portal does not provide a way to deploy multiple NIC VM
  • In this post I’m using Azure Powershell 1.0. If you are using the 0.9.8 or prior, remove the ‘Rm’ suffix from your commands and change the mode to ResourceManager. It highly recommended to update to Azure Powershell 1.0 or later
  • To add a NIC to a existing VM, use this post instead

II- Create a Multiple NIC Virtual Machine

Use the  ‘sample’ Powershell script  to create a multic NIC VM. This script will deploy a Windows Server 2012 R2 Virtual Machine from the gallery. Adjust it to deploy other Operating Systems or to add extra configurations like Availability Set, Static IP, Public IP…

The most important step are :

  • The creation of the VNIC resource before the VM creation. 

$VNIC01 = New-AzureRmNetworkInterface -Name $NIC01Name -ResourceGroupName $RGName -Location $Region -SubnetId $SUBNET01.Id
$VNIC02 = New-AzureRmNetworkInterface -Name $NIC02Name -ResourceGroupName $RGName -Location $Region -SubnetId $SUBNET02.Id

  • Adding the VNICs to the VM configuration object. You must set one VNIC as Primary

$VM = Add-AzureRmVMNetworkInterface -VM $VM -Id $VNIC01.Id -Primary
$VM = Add-AzureRmVMNetworkInterface -VM $VM -Id $VNIC02.Id

Download LINK : https://gallery.technet.microsoft.com/Create-Multi-NIC-Azure-cf216b2d

Azure : Powershell Script to fix IP addresses of a group of Virtual Machine

Hi all,

In my previous post, I posted a script that allow you to fix an Azure virtual machine IP address. But what will you do if you created or have 20 VMs with dynamic IP addresses ? What if you want to set a static IP address for 50 VMs? No worry, I wrote this script that will let you fix IP addresses on a bunch of Azure virtual machines. 

How it works

  • The script use a CSV file that contains the needed information to fix IP addresses for a group of virtual machine. You must provide a valid CSV file as an input. The file is 4 columns separated CSV file : the columns are Name, ServiceName, IpAddress and VirtualNetworkName. You can download and edit this sample CSV file HERE
  • Filling a CSV file can be time consuming and error prone (Specially if we are dealing with tens of VMs). So i added a sweet feature to the script that connect to your Azure subscription and generate a file containing all the VM’s information. you will just edit this CSV file by removing the extra VMs and choosing the right IP addresses

Steps

  • Download and install  the Azure Powershell modules HERE
  • Copy the script to a local location (Example : C:\Scripts)
  • Run an elevated Powershell window
  • change the powershell script execution policy to unrestricted (Set-ExecutionPolicy Unrestricted)

POwershellExecutionpolicy

  • Browse the folder where the script resides and run it using the following syntax
    • If you want to generate a csv file, you will only provide the Azure Subscription Name as an input, a csv file named AzureVMlist.csv will be generated on the same script folder  

.\SetAzureVMStaticIPfromCSV.ps1 -SubscriptionName ‘SubscriptionName

    • If your CSV file is already created, use the following syntax to run the script

.\SetAzureVMStaticIPfromCSV.ps1 -SubscriptionName ‘SubscriptionName‘ -csvpath csvfilepath

Examples

  1. To Generate a CSV file
    .\SetAzureVMStaticIPfromCSV.ps1 -SubscriptionName ‘BuildWindows – SAMIR FARHAT’
  2. Using a CSV file
    .\SetAzureVMStaticIPfromCSV.ps1 -SubscriptionName ‘BuildWindows – SAMIR FARHAT’ -csvpath .\Azurevmlist.csv

NB

  • This script will only work on VMs with one single NIC. I will soon post another script that support fixing IP addresses for VMs with multiple NICs
  • Azure will restart your machines to apply the modifications, so be aware of it

You can download the script here

Azure : Powershell Script to fix an Azure virtual machine IP

Hi All,

When provisioning an Azure virtual machine connected to an Azure network, the machine receives an IP address within the network address space field. Unfortunately, the IP provided is dynamic and provided via an Azure DHCP platform.But, we need to keep in mind some aspects:

  1. If you restart your VM, the IP will remain the same
  2. If you shutdown your VM from the operating system, the machine will be stopped. And when you start back your machine, the VM will will remain the same too.
  3. If you shutdown your VM from the Azure portal or via an Azure powershell command or API, the machine will be stopped. When you start back your VM, the machine may receive a new IP address
  4. If an Azure host or hardware failure occurs, the Azure controller will try to start the machine on a healthy host. The VM may receive a new IP address

The question is why ?

The answer can simply be resumed on two sentences:

  1. The IP address is dynamic, so don’t be surprised that one day, you figure-out that the IP has changed 🙂
  2. There are two types of VM shutdown :
    1. Shutdown without de-provisioning: When you shutdown your VM from the OS itself, the VM is shuttled down but Azure will keep it resources ready (IP, VIP…). The bad news is that Azure will keep billing this VM even if it’s really stopped and dos not use compute resources.
    2. Shutdown with de-provisioning : If you shutdown your VM for the Azure portal, Powershell command or using Azure API, the machine will be stopped and de-provisoned (De-allocated). All its non-static resources will be lost, certainly i’m taling about IP and VIP

Look her for more information about this interesting topic : HERE

To avoid loosing your IP configuration, make your life easier by fixing the IP addresses of your VM.

Until this time, fixing a VM IP address can only be done using powershell. I created this simple Powershell script that can be used to fix your IP address.

Steps

  • Download and install  the Azure Powershell modules HERE
  • Copy the script to a local location (Example : C:\Scripts)
  • Run an elevated Powershell window
  • change the powershell script execution policy to unrestricted (Set-ExecutionPolicy Unrestricted)

POwershellExecutionpolicy

  • You should to provide the following information

Script Parameters

  • Browse the folder where the script resides and run it using the following syntax
    • .\SetAzureVMStaticIP.ps1 -SubscriptionName ‘AAAA’ -VMName  ‘BBBB’ -ServiceName ‘CCCC’ -VNETName  ‘DDDD’ -IP  ‘EEEE’

Example

.\SetAzureVMStaticIP.ps1 -SubscriptionName ‘BuildWindows SAMIR FARHAT’ -VMName  ‘Renault4L01’ -ServiceName ‘Renault4L01’ -VNETName  ‘VNET01’ -IP  ‘192.192.1.100’

NB

  • This script will only work on VMs with one single NIC. I will soon post another script that support fixing IP addresses for VMs with multiple NICs
  • Azure will restart your machine to apply this modification, so be aware of it

Download HERE