Change the license model for a SQL virtual machine in Azure
Applies to: SQL Server on Azure VM
This article describes how to change the license model for a SQL Server virtual machine (VM) in Azure by using the SQL IaaS Agent Extension.
There are three license models for an Azure VM that's hosting SQL Server: pay-as-you-go, Azure Hybrid Benefit (AHB), and High Availability/Disaster Recovery(HA/DR). You can modify the license model of your SQL Server VM by using the Azure portal, the Azure CLI, or PowerShell.
- The pay-as-you-go model means that the per-second cost of running the Azure VM includes the cost of the SQL Server license.
- Azure Hybrid Benefit allows you to use your own SQL Server license with a VM that's running SQL Server.
- The HA/DR license type is used for the free HA/DR replica in Azure.
Azure Hybrid Benefit allows the use of SQL Server licenses with Software Assurance ("Qualified License") on Azure virtual machines. With Azure Hybrid Benefit, customers aren't charged for the use of a SQL Server license on a VM. But they must still pay for the cost of the underlying cloud compute (that is, the base rate), storage, and backups. They must also pay for I/O associated with their use of the services (as applicable).
According to the Microsoft Product Terms: "Customers must indicate that they are using Azure SQL Database (SQL Managed Instance, Elastic Pool, and Single Database), Azure Data Factory, SQL Server Integration Services, or SQL Server Virtual Machines under Azure Hybrid Benefit for SQL Server when configuring workloads on Azure."
To indicate the use of Azure Hybrid Benefit for SQL Server on Azure VM and be compliant, you have three options:
- Provision a virtual machine by using a bring-your-own-license SQL Server image from Azure Marketplace. This option is available only for customers who have an Enterprise Agreement.
- Provision a virtual machine by using a pay-as-you-go SQL Server image from Azure Marketplace and activate the Azure Hybrid Benefit.
- Self-install SQL Server on Azure VM, manually register with the SQL IaaS Agent Extension, and activate Azure Hybrid Benefit.
The license type of SQL Server can be configured when the VM is provisioned, or anytime afterward. Switching between license models incurs no downtime, doesn't restart the VM or the SQL Server service, doesn't add any additional costs, and is effective immediately. In fact, activating Azure Hybrid Benefit reduces cost.
Changing the licensing model of your SQL Server VM has the following requirements:
- An Azure subscription.
- A SQL Server VM registered with the SQL IaaS Agent Extension.
- Software Assurance is a requirement to utilize the Azure Hybrid Benefit license type, but pay-as-you-go customers can use the HA/DR license type if the VM is being used as a passive replica in a high availability/disaster recovery configuration.
Change license model
You can modify the license model directly from the portal:
- Open the Azure portal and open the SQL virtual machines resource for your SQL Server VM.
- Select Configure under Settings.
- Select the Azure Hybrid Benefit option, and select the check box to confirm that you have a SQL Server license with Software Assurance.
- Select Apply at the bottom of the Configure page.
- Azure Cloud Solution Provider (CSP) customers can use the Azure Hybrid Benefit by first deploying a pay-as-you-go VM and then converting it to bring-your-own-license, if they have active Software Assurance.
- If you drop your SQL virtual machines resource, you'll go back to the hard-coded license setting of the image.
- The ability to change the license model is a feature of the SQL IaaS Agent Extension. Deploying an Azure Marketplace image through the Azure portal automatically registers a SQL Server VM with the extension. But, customers who are self-installing SQL Server need to manually register their SQL Server VM.
- Adding a SQL Server VM to an availability set requires re-creating the VM. As such, any VMs added to an availability set go back to the default pay-as-you-go license type. Azure Hybrid Benefit needs to be enabled again.
Changing the license model is:
- Only supported for the Standard and Enterprise editions of SQL Server. License changes for Express, Web, Developer, and Evaluation aren't supported.
- Only supported for virtual machines deployed through the Azure Resource Manager model. Virtual machines deployed through the classic model aren't supported.
Additionally, changing the license model to Azure Hybrid Benefit requires Software Assurance.
Only SQL Server core-based licensing with Software Assurance or subscription licenses are eligible for Azure Hybrid Benefit. If you're using Server + CAL licensing for SQL Server and you have Software Assurance, you can use bring-your-own-license to an Azure SQL Server virtual machine image to use license mobility for these servers, but you can't use the other features of Azure Hybrid Benefit.
Remove a SQL Server instance and its associated licensing and billing costs
Before you begin
To avoid being charged for your SQL Server instance, see Pricing guidance for SQL Server on Azure VMs.
To remove a SQL Server instance and associated billing from a Pay-As-You-Go SQL Server VM, or if you're being charged for a SQL instance after uninstalling it:
- Back up your data.
- If necessary, uninstall SQL Server, including the SQL IaaS Agent extension.
- Download the free SQL Server Express edition.
- Install the SQL IaaS Agent extension.
- To stop billing, change edition in the portal to Express edition.
To disable the SQL Server Express edition service, disable service startup.
Common issues and questions related to licensing
Review the Licensing FAQ to see the most common questions.
Review the commonly known errors and their resolutions.
The resource 'Microsoft.SqlVirtualMachine/SqlVirtualMachines/<resource-group>' under resource group '<resource-group>' was not found
This error occurs when you try to change the license model on a SQL Server VM that hasn't been registered with the SQL IaaS Agent extension:
The Resource 'Microsoft.SqlVirtualMachine/SqlVirtualMachines/\<resource-group>' under resource group '\<resource-group>' was not found. The property 'sqlServerLicenseType' cannot be found on this object. Verify that the property exists and can be set.
Change licensing to AHB, HADR, or PAYG
Make sure your subscription is registered with resource provider (RP).
The SQL IaaS Agent extension is required to change the license. Make sure you remove and reinstall the SQL IaaS Agent extension if it's in a failed state.
How can I deploy a SQL Server BYOL (bring-your-own-license) image?
BYOL images have been retired from Azure Marketplace. You can choose a SQL Server Standard or Enterprise edition marketplace image, and enable Azure Hybrid Benefit during deployment, to create a SQL virtual machine using an existing license.
SQL Server edition, version, or licensing on Azure portal doesn't reflect correctly after edition or version upgrade
Make sure your subscription is registered with resource provider (RP).
The SQL IaaS Agent extension is required to change the license. Make sure you repair the extension if it's in a failed state.
For more information, see the following articles: