Richard J Green

Save with BYOL and Azure Hybrid Benefit

In my post from earlier today, I talked about the benefits of using Azure Instance Reservations to save money on the compute of IaaS virtual machines. When we think about the components that make up an IaaS VM, we have a few: the VM instance and configuration, the storage, and the software that runs on it. For most people, the software at the most basic level will be either Microsoft Windows or Linux and likely some application software layered on top such as SQL Server.

When we are talking about Microsoft Windows there is a license associated with running the operating system and when you commit to running a Microsoft Azure IaaS VM running Microsoft Windows, the cost of that virtual machine includes that license. If you are an enterprise client of Microsoft’s with an Enterprise Agreement you will likely already have entitlement some Windows Server licenses through that agreement. If you already have licenses that you are paying for, why would you want to pay for them again in Azure? The obvious answer is that you wouldn’t unless your intentions are to do away with the Enterprise Agreement and license everything through retail channels.

Microsoft Azure offers a lesser known option called Azure Hybrid Benefit which is often referred to as Hybrid Usage Benefit (HUB for short). HUB allows you to apply your Enterprise Agreement licenses to your IaaS VMs deployed in Azure. What this means in cost terms is that the price of the Azure IaaS VM ceases to include the Windows Server license element and you are paying purely for the compute. The benefits of HUB are not limited to Windows Server either. You can also use the HUB option with SQL Server IaaS VMs deployed to Azure which means you no longer pay the list price in Azure for either the Windows Server or the SQL Server application license.

So the question is, how do you take advantage of Azure Hybrid Benefit? The answer to this lies in the Subscription itself. If you created your Azure Subscriptions using your Enterprise Enrollment Portal then your Subscription is already on-track to be used with HUB. If you created a standalone Subscription using the consumer Azure Portal and the Subscription is a Pay As You Go type then you will need to go back to the drawing board: HUB cannot be applied to an existing PAYG Subscription and only applies to Enterprise Agreement Subscriptions.

Assuming that we are all talking the same language and we are dealing with a Subscription created using the Enterprise Enrollment Portal, we can begin to look at HUB. If you dig into the Virtual Machines blade in the Portal and select New you are presented with a list of available VM templates. In the search field, you can enter [HUB] and this will return all the VM templates available in your Subscription which support the Hybrid Usage Benefit. In my lowly PAYG Subscription, the only HUB option I have is for Windows 10 Enterprise Preview (note the Preview bit), however, in your Subscription you should see the options for Windows Server and SQL Server listed.

If PowerShell and JSON Templates are more your thing, I have a script that I use which will prompt you to select a few options and then provide you with a list of the VM Templates available for your Subscription.

The script itself is pretty short and sweet and does assume that you have already logged in to the correct Subscription using the Login-AzureRmAccount command. Several Grid View prompts will appear asking you to confirm the Region, Image Publisher and Offer will appear: Region is down to you to select and for Publisher, you will want to select MicrosoftWindowsServer if you want to see the Windows Server options or MicrosoftSQLServer if you want to see the SQL options. For Offer, make sure you select the HUB option.

<# .SYNOPSIS Presents a lit of available VM Images based on the customer preferences. 
   .DESCRIPTION Present a list of available VM Images in Azure based on a series of selections. Useful for reporting whether a customers subscription is linked to an Enterprise Agreement and the Hybrid Use Benefit Offer and SKUs are available. 
   .NOTES Author: Richard J Green Version: 1.0 Date: 13th December 2017 
   .EXAMPLE Get-AzureRmVMAvailableImages.ps1 

# Present a list of available Azure regions to select.
$location = Get-AzureRmLocation | Out-GridView -PassThru
# Present a list of available VM Image Publishers to select.
$publisher = Get-AzureRmVMImagePublisher -Location $location.Location | Out-GridView -PassThru
# Present a list of available Image Offers to select.
$offer = Get-AzureRmVMImageOffer -Location $location.Location -Publisher $publisher.PublisherName | Out-GridView -PassThru

# Present the list of SKUs available using the combination of the above location, publisher and offer.
Get-AzureRmVMImageSku -Location $location.Location -Publisher $publisher.PublisherName -Offer $offer.Offer | Select Skus

Once you have run the command, the output will be shown like the example below.

You now know that you can deploy VMs in Azure and take advantage of your existing licensing that is supplied under your Enterprise Agreement. If you read my previous article, about Saving with Azure Reserved Instances then you will be more pleased to hear that you can combine these two schemes. When combined, you are not only, only paying for the compute and not the operating system license but because you have committed to a period of spending for that VM, you save on the compute costs. The Microsoft Azure site reports that you can save up to 82 percent by combining the two although this number only applies to certain VM sizes and OS and SQL Server combinations.

You can head over to the Azure Hybrid Benefit page at which allows you to pump in your Enterprise Agreement licensing numbers, whether the licenses are Standard or Datacenter and what VM size you plan to deploy and the calculator will instruct you how many VMs you can run based on your licensing numbers.

So that is all the good news. Now for something not too great. What happens if you have existing VMs deployed in Azure and you want to use HUB? Unlike Reserved Instances, this cannot be applied retrospectively as HUB is applied at the time at the VM is deployed, however, there is a way out. In Azure, the VM itself (ignoring the storage) is a logical configuration element. By deleting the existing VM and deploying a new one using the HUB template from the gallery we can attach existing VHD file. This will bring the VM back to life in its original form and take advantage of HUB. This isn’t exactly graceful as it will mean bringing down potentially user-facing production servers, however, when you work out the savings it could be worth the time and effort but as always, test these things in development first!

Well that’s another post wrapped up and another wedge of cash saved on your Azure compute. Hopefully, this post and the former post on Azure Reserved Instances go to show that there are options available for using Microsoft Azure for IaaS VMs significantly controlling your spend: cloud isn’t always as expensive as some might say. Merry Christmas!

Exit mobile version