Adding Azure Hybrid Benefit to the ARM Template Deployment

How do you add Azure Hybrid benefit to your automated Azure Resource Manager deployment? In this post i will talk about what and why AHB and how to automate enablement in the deployment

  • What is AHB
  • AHB Tips
  • Add to ARM Template
  • Check AHB
  • Convert existing non AHB to AHB
  • Template in demo repo

What is AHB

Azure Hybrid Benfit is used to save license cost for cloud compute.

https://azure.microsoft.com/en-us/pricing/hybrid-benefit/

From the FAQ: What is the Azure Hybrid Benefit?

The Azure Hybrid Benefit is a pricing benefit for customers who have licenses with Software Assurance, which helps maximize the value of existing on-premises Windows Server and/or SQL Server license investments when migrating to Azure. Eligible customers can save up to 40%* on Azure Virtual Machines (infrastructure as a service, or IaaS), and save up to 55% on Azure SQL Database (platform as a service, or PaaS) and SQL Server on Azure Virtual Machines (IaaS) with Azure Hybrid Benefit, which increases to up to 80% when combined with Azure Reserved Instance.

To give concrete example.

Look at the pricing example for Windows vs Linux.

With AHB you would not pay the “renting price” for the Windows license and therefore only pay compute as you do with Linux.

So if you have Software assurance use AHB.

AHB Tips

I wrote about this in a previous post, in this post I Iinked to a more detailed post from Anders Bonde.

FinOps Step 5: Optimize License Cost

Conclusions:

+ AHB (Azure Hybrid Benefit) is a benefit to convert or re-use eligible Windows Server licenses and run Windows Server virtual machines in Azure for a lower Compute rate.

+ AHB is server-based; e.g. assigned to specific named servers

+ Rule-of-Thumb: Cover the Baseline with AHB and the Peaks as PAYG Windows

+ AHB prioritized order of use:

  • Use existing: Windows Server Datacenter licenses with SA
  • Use existing: Windows Server Standard licenses with SA, not used on-premise
  • Buy new Windows: Server Standard licenses with SA

+ How to buy Windows Server licenses for Azure servers

  • For B servers: Always PAYG
  • For non-B servers with 8+ cores and running 24×7 (or close): Always AHB
  • High monthly utilization & high no of cores (~8 or above): Consider AHB
  • Low monthly utilization & low no of cores (<<8): Consider PAYG

+ Note the “0.046$ rule” for PAYG Windows Server cost

  • The PAYG Windows Server cost is 0.046$ per core per hour for most VM’s in most regions for both PAYG & RI VM’s
  • Note important exceptions for PAYG Windows for B, Dv2, H and Mm servers

Add to ARM Template

So safe to say is you would like to have this automated in your provisioning flow.

I use my previous ARM template posts as base and only add the line  “licenseType”: “Windows_Server”, in the “properties”  for the “type”: “Microsoft.Compute/virtualMachines”,  in the Linked Template

This will enable the AHB for your VMs during deployment.

Also see this documentation for reference:

https://docs.microsoft.com/en-us/azure/virtual-machines/windows/hybrid-use-benefit-licensing#template

Check AHB

If you want to check if you have AHB enabled you can check in the CloudShell, Powershell or portal as described here.

https://docs.microsoft.com/en-us/azure/virtual-machines/windows/hybrid-use-benefit-licensing#list-all-vms-with-azure-hybrid-benefit-for-windows-server-in-a-subscription

PowerShell:

  • $vms = Get-AzVM
  • $vms | ?{$_.LicenseType -like “Windows_Server”} | select ResourceGroupName, Name, LicenseType

Portal Example.

Convert existing non AHB to AHB

You might already have a bunch of VMs deployed that you want to convert to AHB, then just follow this guidance.
https://docs.microsoft.com/en-us/azure/virtual-machines/windows/hybrid-use-benefit-licensing#convert-an-existing-vm-using-azure-hybrid-benefit-for-windows-server

Template in demo repo

I have added an additional linked template to the demorepo for reference.

https://github.com/BMichaelJ/Scripts-and-templates/tree/master/Templates/NestedDomainJoin

One thought on “Adding Azure Hybrid Benefit to the ARM Template Deployment

Leave a Comment