When you deploy Windows-based and Linux-based Virtual Machines on Microsoft Azure, there’s an option to re-use existing licenses you already own on-premises for workloads running in the public cloud. This is known as Azure Hybrid Benefit for Windows Server, SQL Server and Linux Server, and Multitenant Hosting Rights for Windows Client. I am not sure why they are called differently, but the benefit is the same (cost savings without paying for another license).
This article will show you how to check and verify your Azure VM is utilizing the Azure Hybrid Benefit for Windows Server, Linux Server, and Windows Client using the Azure PowerShell.
Table of Contents
Introduction
Azure Hybrid Benefit is a licensing benefit that helps you significantly reduce the costs of running your workloads in Microsoft Azure. It works by letting you use your on-premises Software Assurance-enabled Windows Server and SQL Server licenses on Azure.
If you have a Software Assurance agreement with Microsoft, you can use Azure Hybrid Benefit for Windows Server to deploy new virtual machines with Windows OS.

For more information about Azure Hybrid Benefit for Windows Server and SQL Server and cost savings, please check the Azure Hybrid Benefit licensing page here.
The good news is, that Azure Hybrid Benefit also applies to Red Hat Enterprise Linux (RHEL) and SUSE Linux Enterprise Server (SLES) subscriptions. With this benefit, you pay for only the infrastructure costs of your VM because your RHEL or SLES subscription covers the software fee.

For more information about Azure Hybrid Benefit for Linux virtual machines and cost savings, please check the Azure Hybrid Benefit licensing page here.
Similarly, if you have Windows 10 Enterprise E3/E5 per user or Windows Virtual Desktop/Azure Virtual Desktop Access (VDA) per user (User Subscription Licenses or Add-on User Subscription Licenses), then you can use Multitenant Hosting Rights for Windows 10 which allows you to bring your Windows 10 Licenses to the cloud and run Windows Client Virtual Machines on Azure without paying for another license.

For more information about Multitenant Hosting Rights for Windows Client licensing and cost savings, please check the Multitenant Hosting for Windows 10 page here.
Please note that the same benefit also applies if Windows Server and SQL Server subscriptions licence are acquired over a Cloud Solution Provider (CSP) program.
In this article, I will share with you a PowerShell script that will help you to get the list of all licensing types of your virtual machines in all Azure subscriptions, and then export it to a comma-separated value (CSV) format. This comes in handy when working with many VMs in Azure, and you want to audit and correct the licensing type.
Prerequisites
To follow this article, you need to have the following:
1) Azure subscription – If you don’t have an Azure subscription, you can create a free one here.
2) Azure Resource Group obviously.
3) At least one Windows-based Azure VM deployed, this could be Windows Server, Linux Server, or Windows 10 deployed straight from the Azure Gallery or uploaded to Azure.
4) The Azure PowerShell (Az module) is installed locally on your machine. You can use the following PowerShell command to install and update the “Az module”. You could also use the Azure Cloud Shell.
# Make sure you have the latest version of PowerShellGet installed
Install-Module -Name PowerShellGet -Force
# Install and update to the latest Az PowerShell module
Install-Module -Name Az -AllowClobber -Force
Verify licensing type with PowerShell
The PowerShell script below will give you a list of all the Windows and Linux Virtual machines in all Azure subscriptions, where you can verify which VM is using the Azure Hybrid Benefit and which VM is not- giving you a quick list of all VMs to check the settings on.
<#
.Synopsis
A script used to export all Azure VM licensing type in all your Azure Subscriptions.
.DESCRIPTION
A script used to get the list of all Azure virtual machines in all your Azure Subscriptions.
Finally, it will export the report into a csv file in your Azure Cloud Shell storage.
.Notes
Created : 05-July-2021
Updated : 06-July-2021
Version : 1.0
Author : Charbel Nemnom
Twitter : @CharbelNemnom
Blog : https://charbelnemnom.com
Disclaimer: This script is provided "AS IS" with no warranties.
#>
$azSubs = Get-AzSubscription
foreach ( $azSub in $azSubs ){
Set-AzContext -Subscription $azSub | Out-Null
$azSubName = $azSub.Name
$AzureVM = @()
foreach ($azVM in Get-AzVM) {
$props = @{
VMName = $azVM.Name
Region = $azVM.Location
OsType = $azVM.StorageProfile.OsDisk.OsType
ResourceGroupName = $azVM.ResourceGroupName
}
if (!$azVM.LicenseType) {
$props += @{
LicenseType = "No_License"
}
}
else {
$props += @{
LicenseType = $azVM.LicenseType
}
}
$ServiceObject = New-Object -TypeName PSObject -Property $props
$AzureVM += $ServiceObject
}
$AzureVM | Export-Csv -Path "$($home)\clouddrive\$azSubName-AzVM-Licensing.csv" -NoTypeInformation -force
}
From the example above, we are exporting the following information:
- Azure VM Name
- Azure VM Region
- Azure VM licensing type
- Azure VM OS Type (Windows / Linux)
- Azure Resource Group Name
Run the script
To run the script, you can either install the latest Azure PowerShell version on your machine as described in the prerequisites section, or you can jump over the Cloud Shell (https://shell.azure.com), or use the Azure Cloud Shell Connector in Windows Terminal.
The report will be saved in the cloud drive path following the Azure Subscription name (-AzVM-Licensing.csv).
And here is the final report in CSV:

Please note that you can accomplish the same thing using Azure CLI, and Azure Resource Graph, however, I prefer to use Azure PowerShell for small to medium deployment.
Hope this helps!
Summary
In this quick article, I showed you how to check the Azure Hybrid Benefit for Windows Server, Linux Server, and Windows Client with PowerShell.
Azure Hybrid Benefit for Windows and Linux allows you to use your on-premises licenses and run virtual machines on Azure at a reduced cost.
This is version 1.0, do you want additional features? Please feel free to leave a comment below.
__
Thank you for reading my blog.
If you have any questions or feedback, please leave a comment.
-Charbel Nemnom-
Thank you for the instructions.
Something I’m missing is confirming what the different LicenseTypes mean.
For example, does a LicenseType of “Windows_Server” mean hybrid-use rights have been leveraged?
Hello Daniel, thanks for the comment!
Yes, the LicenseType of “Windows_Server” means that hybrid-use rights have been leveraged.
Hope it helps!