Explanation
Why the waste happens and who it affects.
Microsoft grants free licensing for one passive secondary replica for high availability and one passive secondary for disaster recovery per SQL Server. Since November 2022 this applies to pay-as-you-go licensing as well as Azure Hybrid Benefit when the replicas are hosted in Azure, and Microsoft notes that it cuts the licensing cost of a highly available deployment by more than half.
The benefit is not applied automatically. Each SQL Server VM carries a license type on its SQL virtual machine resource (pay-as-you-go, Azure Hybrid Benefit, or HA/DR), and secondaries built from the same pay-as-you-go image or template as the primary keep the paid license type. The result is a full SQL license charge, scaled by vCPU count, on replicas that only receive replication and wait for failover. A related trap: adding a SQL Server VM to an availability set requires recreating the VM, which resets it to the default pay-as-you-go license type.
Billing model
The pricing dimensions that drive this cost.
SQL Server on Azure VMs uses one of three license types per VM.
- Pay-as-you-go (PAYG)
- The per-second VM price includes the SQL Server license, which scales with vCPU count
- Azure Hybrid Benefit (AHUB)
- Owned SQL Server licenses with Software Assurance are applied, removing the license charge but consuming license entitlements
- HA/DR license type
- Used for the free passive replica; the VM pays only for compute, storage and networking, with no SQL Server license charge
- Free replica allowance
- One passive secondary for high availability and one passive secondary for disaster recovery per SQL Server
How to detect
4 checks to find it in your estate.
- Query Azure Resource Graph for microsoft.sqlvirtualmachine/sqlvirtualmachines and project properties.sqlServerLicenseType, grouping VMs that belong to the same availability group or failover cluster
- Flag secondary replicas whose license type is PAYG or AHUB rather than DR, and confirm from the availability group configuration that they are passive (not readable secondaries or otherwise serving workloads)
- Review SQL Server license meter charges in Cost Management for VMs that host only secondary replicas
- After any rebuild, availability set move or redeployment, re-check the license type of the affected replicas, since recreated VMs return to pay-as-you-go
How to fix
5 ways to remove the waste.
- Set the license type of qualifying passive replicas to HA/DR in the SQL virtual machine resource (Settings, Configure, SQL Server License), or with az sql vm update --license-type DR or Update-AzSqlVM -LicenseType DR; the change needs no restart and takes effect immediately
- Apply HA/DR to at most one passive HA secondary and one passive DR secondary per SQL Server, and keep any readable or active secondary on a paid license type
- Confirm the replicas meet the passive-replica conditions in the Microsoft product licensing terms before changing, since using a replica for active workloads makes it licensable
- Register self-installed SQL Server VMs with the SQL IaaS Agent extension so their license type can be set, and add the license type to deployment templates or an Azure Policy so new replicas start as HA/DR
- If centrally managed Azure Hybrid Benefit is enabled, identify passive and DR environments there, because per-VM license changes are disabled
Documentation
Vendor references for pricing and configuration.
- Price Guidance & Managing Costs - SQL Server on Azure VMslearn.microsoft.com
- Change the License Model for a SQL VM in Azure - SQL Server on Azure VMslearn.microsoft.com
- High Availability, Disaster Recovery, Business Continuity - SQL Server on Azure VMslearn.microsoft.com
- FinOps best practices for computelearn.microsoft.com