Azure Hybrid Benefit (AHB) for SQL Server allows you to use on-premises licenses to run SQL Server on Azure Virtual Machines. If you have Software Assurance, you can use AHB when deploying a new SQL VM or activate SQL Server AHB for an existing SQL VM with a pay as you go (PAYG) license. Bring your own license (BYOL) SQL Images on Azure Marketplace should be used to implement SQL Server AHB when deploying a new SQL VM. However, if you already have a SQL VM with a PAYG license, activating AHB currently requires re-deploying the VM with BYOL SQL image.
Today, we are revealing a new, simple way to activate SQL Server AHB on Azure VM with SQL VM Resource Provider. SQL VM resource provider is a new Azure resource provider, Microsoft. SqlVirtualMachine, that supplies SQL Server configurations for an Azure VM as a resource that can be deployed and managed through Azure Resource Manager. This new infrastructure brings a backend management service for SQL Server on Azure VM including dynamic updates of SQL Server settings such as license type. To activate SQL Server AHB for an existing PAYG SQL VM, simply create a Microsoft. SqlVirtualMachine/SqlVirtualMachine type resource for the existing VM by providing the VM's resource ID and setting SqlServerLicenseType as “AHUB.”
Example PowerShell command to activate AHB for PAYG SQL VM:
// Get existing plain vm $vm = Get-AzureRmVm -ResourceGroupName <resource_group_name> -Name <virtual_machine_name> // Create an AHUB SqlVm New-AzureRmResource -ResourceName $vm.Name -ResourceGroupName $vm.ResourceGroupName -Location $vm.Location -ResourceType Microsoft.SqlVirtualMachine/sqlVirtualMachines -Properties @{virtualMachineResourceId=$vm.Id;sqlServerLicenseType="AHUB"}
If you have not set SqlServerLicenseType property while creating SqlVirtualMachine resource, then the SqlServerLicenseType will be set as “PAYG” by default. You can use this method to convert SQL License of a self-deployed SQL VM (not deployed from Marketplace SQL Server images) to PAYG. At any time, you can update the SqlServerLicenseType property as “AHUB” to activate SQL Server AHB if you have Software Assurance:
// Update SqlVirtualMachine SqlServerLicenseType property $SqlVm = Get-AzureRmResource -ResourceType Microsoft.SqlVirtualMachine/SqlVirtualMachines -ResourceGroupName <resource_group_name> -ResourceName <sql_virtual_machine_name> $SqlVm.Properties.sqlServerLicenseType="AHUB" $SqlVm | Set-AzureRmResource -Force
You should register your subscription with Microsoft. SqlVirtualMachine provider by running the following PowerShell command or register through azure portal to create SqlVirtualMachine type resources:
Register-AzureRmResourceProvider -ProviderNamespace Microsoft.SqlVirtualMachine
No downtime
New SqlVirtualMachine resource links to the existing VM resource; this has no impact on the existing VM resources. SqlVirtualMachine resource will manage the metadata about SQL Server settings by reading them from SQL IaaS Extension properties. If the VM is deleted, this notifies the linked SqlVirtualMachine resource, which also gets deleted asynchronously. SqlVirtualMachine resource can be deleted independently, by keeping the VM resource. However, SQL Server license changes fall back to the original state in this case.
No VM restart
Activating SQL Server AHB for a PAYG SQL VM does not restart the VM, and it does not impact any of the existing resources. It only updates the metadata representing the SQL Server license type which defines the bill for the VM resource.
No additional cost
SqlVirtualMachine resource manages all existing SQL Server configurations available today, including automated backup, patching, Azure Key Vault Integration and storage configuration, and also new “SqlServerLicenseType.” The additional resource and enhanced manageability have no additional cost.
Effective immediately
Billing for an Azure resource is generated by multiplying the per-second cost of each resource with the used seconds in an hour. The SQL Server license cost will be removed from the bill of the VM resource immediately after the SQL Server license type is updated as “AHUB.” You can verify the changes in the daily Azure bill. To deactivate SQL Server AHB, simply run the same update command by setting SQL Server License type as PAYG. The per-second SQL Server license cost will be added to the VM bill immediately after the new command is executed.
One solution for all subscription types
Customers with Software Assurance have SQL Server AHB rights independent of the subscription type. Older solutions for activating SQL Server AHB on Azure VM based on BYOL SQL images were only available for EA customers, but the new solution described above is applicable to all subscriptions with Software Assurance.
With new Microsoft. SqlVirtualMachine resource provider you can manage SQL server configurations on Azure VMs dynamically. Flexible SQL Server License type configuration is the first feature we are delivering with SQL VM resource provider, and it enables instant and significant cost savings for SQL VM.