Checking Hybrid Benefits in Azure with PowerShell
When using Windows-based Virtual Machines on Microsoft Azure, there’s an option to use Azure Hybrid Benefit to re-use existing Windows licenses you own on-premises for workloads now running in the public cloud.
This PowerShell snippet will list all the Windows Virtual machines (in the current subscription- use Set-AzContext
to change that) which are not making use of the Hybrid Benefits- giving you a quick list of VMs to check the settings on.
1Get-AzVM | Where-Object {$_.OSProfile.WindowsConfiguration -and !($_.LicenseType)}