แก้ไข

แชร์ผ่าน


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 SQL Server on Azure Virtual Machines (VMs), such as, to enable the Azure Hybrid Benefit.

Overview

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

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).

To estimate your cost savings with the Azure Hybrid benefit, use the Azure Hybrid Benefit Savings Calculator. To estimate the cost of Pay as you Go licensing, review the Azure Pricing Calculator.

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.

Prerequisites

Changing the licensing model of your SQL Server VM has the following requirements:

Change license model

You can modify the license model directly from the portal:

  1. Open the Azure portal and open the SQL virtual machines resource for your SQL Server VM.
  2. Select Configure under Settings.
  3. Select the Azure Hybrid Benefit option, and select the check box to confirm that you have a SQL Server license with Software Assurance.
  4. Select Apply at the bottom of the Configure page.

Screenshot showing the Azure Hybrid Benefit in the portal.

Integration with centrally managed Azure Hybrid Benefit

Centrally managed Azure Hybrid Benefit (CM-AHB) is a service that helps customers optimize their Azure costs and use other benefits such as:

  • Move all pay-as-you-go (full price) SQL PaaS/IaaS workloads to take advantage of your Azure Hybrid Benefits without have to individually configure them to enable the benefit.
  • Ensure that all your SQL workloads are licensed in compliance with the existing license agreements.
  • Separate the license compliance management roles from devops roles using RBAC.
  • Take advantage of free business continuity by ensuring that your passive & disaster recovery (DR) environments are properly identified.
  • Use MSDN licenses in Azure for non-production environments.

CM-AHB uses data provided by the SQL IaaS Agent extension to account for the number of SQL Server licenses used by individual Azure VMs and provides recommendations to the billing admin during the license assignment process. Using the recommendations ensures that you get the maximum discount by using Azure Hybrid Benefit. If your VMs aren't registered with the SQL IaaS Agent extension when CM-AHB is enabled by your billing admin, the service won't receive the full usage data from your Azure subscriptions and therefore the CM-AHB recommendations will be inaccurate.

To get started, review Transition to centrally managed Azure Hybrid Benefit.

Once CMB-AHB is enabled for a subscription, the License type on the Overview pane of your SQL virtual machines resource in the Azure portal displays Centrally Managed.

With CMB-AHB, making license type changes to individual VMs is no longer possible, and you see the following message on the Configure pane of your SQL virtual machines resource:

Your organization manages licenses assigned to Azure at a scope level such as Azure subscription instead of each individual resource. Billing administrators can manage licenses centrally under Cost Manamagent + Billing.

Important

If automatic registration is activated after Centrally Managed-AHB (CM-AHB) is enabled, you run the risk of unnecessary pay-as-you-go charges for your SQL Server on Azure VM workloads. To mitigate this risk, adjust your license assignments in CM-AHB to account for the additional usage that will be reported by the SQL IaaS Agent extension after auto-registration. We published an open source tool that provides insights into the utilization of SQL Server licenses, including the utilization by the SQL Servers on Azure Virtual Machines that are not yet registered with the SQL IaaS Agent extension.

Remarks

  • 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.

Limitations

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.

Note

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:

  1. Back up your data.
  2. If necessary, uninstall SQL Server, including the SQL IaaS Agent extension.
  3. Download the free SQL Server Express edition.
  4. Install the SQL IaaS Agent extension.
  5. To stop billing, change edition in the portal to Express edition.

Optional

To disable the SQL Server Express edition service, disable service startup.

Review the Licensing FAQ to see the most common questions.

Known errors

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.

You need to register your SQL Server VM with the SQL IaaS Agent extension.

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 delete 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.

Next steps

For more information, see the following articles: