如何将 Azure 混合权益应用于托管实例?

How to apply Azure Hybrid Benefit to Managed Instance?

使用 Azure 混合权益 (AHB),现有的本地 SQL 服务器许可证可以转换为 Azure SQL 托管实例价格的 40% 折扣。如果已经创建了没有 AHB 的托管实例,如何在现有托管实例上应用 Azure 混合权益?

将托管实例转换为 AHB 的最简单方法是转到 Azure 门户,打开托管实例的详细信息,转到 Setting/Pricing 层并确认您拥有要使用的有效 SA 许可证.

可以使用 AzureRm.Sql PowerShell 库和 Set-AzureRmSqlManagedInstance 命令将托管实例的定价转换为 AHB:

Set-AzureRmSqlManagedInstance `
               -Name $instanceName `
               -ResourceGroupName $resourceGroup `
               -LicenseType BasePrice

您可以使用 AzureRm 库和 Set-AzureRmResource 命令代替 AzureRm.Sql:

$subId = "70b3d058-a51a-****-****-**********"
$resourceGroup = "my-resource-group"
$instanceName = "my-instance"

Select-AzureRmSubscription -SubscriptionId $subId

$properties = New-Object System.Object
$properties | Add-Member -type NoteProperty -name licenseType -Value BasePrice

Set-AzureRmResource -Properties $properties `
                    -ResourceName $instanceName `
                    -ResourceType "Microsoft.SQL/managedInstances" `
                    -ResourceGroupName $resourceGroup -Force `
                    -ApiVersion "2015-05-01-preview"

Azure CLI 可用于通过 az sql mi update 命令更新许可证类型:

az sql mi update -g my_res_group -n my-managed-instance --license-type BasePrice

另一个选项是使用 Azure 门户:

  1. 在创建托管实例时,在门户的配置中(配置 vCore 和存储的地方),有一个应用 AHB(Azure 混合优势)的选项
  2. 随后,部署托管实例后,转到“定价层”,您将再次获得提供的 AHB 选项。 附上屏幕截图(适用于两者)