您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

更改 Azure 中 SQL Server 虚拟机的许可证型号Change the license model for a SQL Server virtual machine in Azure

本文介绍如何使用新的 SQL VM 资源提供程序SqlVirtualMachine在 Azure 中更改 SQL Server 虚拟机(VM)的许可证模型。This article describes how to change the license model for a SQL Server virtual machine (VM) in Azure by using the new SQL VM resource provider, Microsoft.SqlVirtualMachine.

承载 SQL Server 的 VM 有两个许可证模型:即用即付和 Azure 混合权益。There are two license models for a VM that's hosting SQL Server: pay-as-you-go and Azure Hybrid Benefit. 您可以使用 Azure 门户、Azure CLI 或 PowerShell 来修改您的 SQL Server VM 的许可证模型。You can modify the license model of your SQL Server VM by using the Azure portal, the Azure CLI, or PowerShell.

即用即付模型意味着运行 Azure VM 的每秒费用包括 SQL Server 许可证的成本。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 混合权益允许你将自己的 SQL Server 许可证与运行 SQL SERVER 的 VM 一起使用。Azure Hybrid Benefit allows you to use your own SQL Server license with a VM that's running SQL Server.

Azure 混合权益允许在 Azure 虚拟机上使用带有软件保障("合格许可证")的 SQL Server 许可证。Azure Hybrid Benefit allows the use of SQL Server licenses with Software Assurance ("Qualified License") on Azure virtual machines. 使用 Azure 混合权益,客户无需支付对 VM 使用 SQL Server 许可证的费用。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. 他们还必须为与服务的使用相关的 i/o 付费(如果适用)。They must also pay for I/O associated with their use of the services (as applicable).

根据 Microsoft 产品条款: "客户必须指出他们正在使用 Azure SQL 数据库(托管实例、弹性池和单一数据库)、Azure 数据工厂、SQL Server Integration Services 或 SQL Server Azure 中的虚拟机在 Azure 上配置工作负荷时 SQL Server 的混合权益。According to the Microsoft Product Terms: "Customers must indicate that they are using Azure SQL Database (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."

若要指示在 Azure VM 上使用 SQL Server 的 Azure 混合权益,并符合以下三个选项:To indicate the use of Azure Hybrid Benefit for SQL Server on an Azure VM and be compliant, you have three options:

  • 使用 Azure Marketplace 中的自带许可证 SQL Server 映像预配虚拟机。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.
  • 使用 Azure Marketplace 中的即用即付 SQL Server 映像预配虚拟机,并激活 Azure 混合权益。Provision a virtual machine by using a pay-as-you-go SQL Server image from Azure Marketplace and activate the Azure Hybrid Benefit.
  • 在 Azure VM 上自行安装 SQL Server,使用 SQL VM 资源提供程序手动注册,并激活 Azure 混合权益。Self-install SQL Server on an Azure VM, manually register with the SQL VM resource provider, and activate Azure Hybrid Benefit.

预配 VM 时,将设置 SQL Server 的许可证类型。The license type of SQL Server is set when the VM is provisioned. 您可以在以后随时对其进行更改。You can change it anytime afterward. 在许可证模型之间切换不会造成停机,也不会重新启动 VM 或 SQL Server 服务,不会添加任何额外的费用,并且立即生效。Switching between license models incurs no downtime, does not restart the VM or the SQL Server service, doesn't add any additional costs, and is effective immediately. 事实上,激活 Azure 混合权益降低了成本。In fact, activating Azure Hybrid Benefit reduces cost.

必备组件Prerequisites

更改 SQL Server VM 的许可模式具有以下要求:Changing the licensing model of your SQL Server VM has the following requirements:

更改已注册到资源提供程序的 Vm 的许可证Change the license for VMs already registered with the resource provider

备注

以下屏幕截图来自 Azure 门户中的SQL 虚拟机资源。The following screenshots are from the SQL virtual machines resource within the Azure portal. 对于不在SQL VM 资源提供程序中注册的支持结束 (EOS) sql Server vm 和 SQL Server vm, 请改用SQL Server 配置选项卡来管理 SQL Server VM。For end-of-support (EOS) SQL server VMs, and SQL Server VMs that have not been registered with the SQL VM resource provider, use the SQL Server configuration tab to manage your SQL Server VM instead.

可以直接从门户修改许可证模型:You can modify the license model directly from the portal:

  1. 打开Azure 门户并打开 SQL Server VM 的SQL 虚拟机资源Open the Azure portal and open the SQL virtual machines resource for your SQL Server VM.
  2. 选择 "设置" 下的 "配置"。Select Configure under Settings.
  3. 选择 " Azure 混合权益" 选项,然后选中该复选框以确认你具有具有软件保障的 SQL Server 许可证。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.

门户中的 Azure 混合权益

更改未注册到资源提供程序的 Vm 的许可证Change the license for VMs not registered with the resource provider

如果你从即用即付 Azure Marketplace 映像预配了 SQL Server VM,则 SQL Server 许可证类型将为 "即用即付"。If you provisioned a SQL Server VM from pay-as-you-go Azure Marketplace images, then the SQL Server license type will be pay-as-you-go. 如果使用 Azure Marketplace 中的自带许可证映像预配了 SQL Server VM,则许可证类型将为 AHUB。If you provisioned a SQL Server VM by using a bring-your-own-license image from Azure Marketplace, then the license type will be AHUB. 默认情况下(即用即付)或自带许可 Azure Marketplace 映像中预配的所有 SQL Server Vm 将自动注册到 SQL VM 资源提供程序,因此它们可以更改许可证类型All SQL Server VMs provisioned from default (pay-as-you-go) or bring-your-own-license Azure Marketplace images will automatically be registered with the SQL VM resource provider, so they can change the license type.

仅可通过 Azure 混合权益在 Azure VM 上自行安装 SQL Server。You are only eligible to self-install SQL Server on an Azure VM via Azure Hybrid Benefit. 你应将这些 vm 注册到 SQL VM 资源提供程序,方法是将 SQL Server 许可证设置为 Azure 混合权益,以根据 Microsoft 产品条款指示 Azure 混合权益的使用情况。You should register these VMs with the SQL VM resource provider by setting the SQL Server license as Azure Hybrid Benefit, to indicate the Azure Hybrid Benefit usage according to Microsoft Product Terms.

仅当 SQL Server VM 注册到 SQL VM 资源提供程序时,才能将 SQL Server VM 的许可证类型更改为即用即付或 Azure 混合权益。You can change the license type of a SQL Server VM as pay-as-you-go or Azure Hybrid Benefit only if the SQL Server VM is registered with the SQL VM resource provider.

备注Remarks

  • Azure 云解决方案提供商(CSP)客户可以通过先部署即用即付 VM,然后将其转换为自带许可(如果他们具有有效的软件保障)来使用 Azure 混合权益。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.
  • 如果删除 SQL Server VM 资源,则会返回到映像的硬编码许可证设置。If you drop your SQL Server VM resource, you will go back to the hard-coded license setting of the image.
  • 更改许可模式的功能是 SQL VM 资源提供程序的一项功能。The ability to change the license model is a feature of the SQL VM resource provider. 通过 Azure 门户部署 Azure Marketplace 映像会自动向资源提供程序注册 SQL Server VM。Deploying an Azure Marketplace image through the Azure portal automatically registers a SQL Server VM with the resource provider. 但自行安装 SQL Server 的客户需要手动注册其 SQL Server VMBut customers who are self-installing SQL Server will need to manually register their SQL Server VM.
  • 若要将 SQL Server VM 添加到可用性集,则需要重新创建 VM。Adding a SQL Server VM to an availability set requires re-creating the VM. 因此,添加到可用性集的任何 Vm 都将恢复为默认的即用即付许可证类型。As such, any VMs added to an availability set will go back to the default pay-as-you-go license type. 需要重新启用 Azure 混合权益。Azure Hybrid Benefit will need to be enabled again.

限制Limitations

更改许可模式的步骤如下:Changing the license model is:

  • 仅适用于具有软件保障的客户。Only available to customers with Software Assurance.
  • 仅 SQL Server 标准版和企业版支持。Only supported for the Standard and Enterprise editions of SQL Server. 不支持速成版、Web 版和开发人员版的许可证更改。License changes for Express, Web, and Developer are not supported.
  • 仅支持通过 Azure 资源管理器模型部署的虚拟机。Only supported for virtual machines deployed through the Azure Resource Manager model. 不支持通过经典模型部署的虚拟机。Virtual machines deployed through the classic model are not supported.
  • 仅适用于公共或 Azure 政府云。Available only for the public or Azure Government clouds.
  • 仅在具有单个网络接口(NIC)的虚拟机上受支持。Only supported on virtual machines that have a single network interface (NIC).

已知错误Known errors

找不到资源组 "<资源组 >" 下的资源 "SqlVirtualMachine/SqlVirtualMachines/<资源组 >"。The Resource 'Microsoft.SqlVirtualMachine/SqlVirtualMachines/<resource-group>' under resource group '<resource-group>' was not found.

当你尝试在尚未注册到 SQL VM 资源提供程序的 SQL Server VM 上更改许可证模型时,将发生此错误:This error occurs when you try to change the license model on a SQL Server VM that has not been registered with the SQL VM resource provider:

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.

你需要向资源提供程序注册你的订阅,然后向资源提供程序注册你的 SQL Server VMYou'll need to register your subscription with the resource provider, and then register your SQL Server VM with the resource provider.

虚拟机 "<vmname>" 与多个 NIC 关联The virtual machine '<vmname>' has more than one NIC associated

此错误发生在具有多个 NIC 的虚拟机上。This error occurs on virtual machines that have more than one NIC. 在更改许可模式之前,请删除其中一个 Nic。Remove one of the NICs before you change the licensing model. 虽然你可以在更改许可证模型后将 NIC 添加回 VM,但将不再支持 Azure 门户中的操作(如自动备份和修补)。Although you can add the NIC back to the VM after you change the license model, operations in the Azure portal such as automatic backup and patching will no longer be supported.

后续步骤Next steps

有关详细信息,请参阅以下文章:For more information, see the following articles: