Skip to main content Explore View all products (200+) Microsoft Foundry Azure Copilot GitHub Copilot Azure Kubernetes Service (AKS) Azure Cosmos DB Azure Database for PostgreSQL Azure Arc Microsoft Fabric Linux virtual machines in Azure Foundry Models Foundry Agent Service Foundry IQ Foundry Tools Foundry Control Plane Observability in Foundry Control Plane Azure OpenAI in Foundry Models Azure Speech in Foundry Tools Azure Machine Learning View all databases Azure Cosmos DB Azure DocumentDB Azure SQL Azure Database for PostgreSQL Azure Managed Redis Microsoft Fabric Azure Databricks Linux virtual machines in Azure Windows Server on Azure Azure Functions Azure Virtual Machine Scale Sets Azure API Management Azure Container Apps Azure Kubernetes Service (AKS) Azure Kubernetes Fleet Manager Azure Container Registry Azure Red Hat OpenShift Azure Container Instances Azure Container Storage Azure Arc Azure Local Microsoft Defender for Cloud Azure Monitor Microsoft Sentinel Azure Migrate View all solutions (40+) Cloud solutions for small and medium businesses Cloud migration and modernization center Data analytics for AI Azure Databases AI apps and agents Microsoft Marketplace Microsoft Sovereign Cloud AI apps and agents Responsible AI with Azure AI Infrastructure Data analytics for AI Machine learning operations (MLOps) Low-code application development on Azure Integration Services Serverless computing DevOps Migration and modernization center .NET apps migration Databases on Azure Linux on Azure Oracle on Azure SAP on the Microsoft Cloud Adaptive cloud High-performance computing (HPC) Infrastructure as a service (IaaS) Resiliency Azure Essentials Frontier Accelerate for Azure FinOps on Azure Microsoft Marketplace Azure pricing overview Create an Azure account Free Azure services Flexible purchase options Pricing calculator FinOps on Azure Maximize ROI from AI Azure savings plans Azure reservations Azure Hybrid Benefit Virtual Machines Azure SQL Microsoft Foundry Microsoft Fabric Azure Kubernetes Service (AKS) Microsoft Defender for Cloud View more Software Development Companies Microsoft Marketplace Find a partner Resources for Azure partners Get started with Azure Customer stories Analyst reports, white papers, and e-books Videos Learn more about cloud computing Documentation Explore Azure portal Developer resources Quickstart templates Resources for startups Developer community Students Azure for partners Blog Events and Webinars Learn Support Contact Sales Get started with Azure Sign in

Please note, this post has been updated by replacing the Azure PowerShell examples with recently published Azure SQL VM CLI.

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

First of all, you should register your subscription with Microsoft. SqlVirtualMachine provider by running the following Azure CLI command or register through Azure Portal to create SqlVirtualMachine type resources:

// Register subscription with SQL VM RP

az provider register --namespace Microsoft.SqlVirtualMachine --subscription 

Then, install or update Azure CLI by downloading the MSI package to get access to Azure SQL VM CLI.

Below is Azure SQL VM Create CLI command to activate AHB for existing PAYG SQL VM:

// Create an AHUB SqlVm
az sql vm create -n  -g  -l  --license-type AHUB
EX: az sql vm create -n sqlvm -g myresourcegroup -l eastus --license-type AHUB

If you have not set SqlServerLicenseType property while creating SqlVirtualMachine resource, then the SqlServerLicenseType will be set as “PAYG” by default. At any time, you can update the SqlServerLicenseType property as “AHUB” to activate SQL Server AHB if you have Software Assurance with the following Azure SQL VM Update CLI command:

// Update SqlVirtualMachine SqlServerLicenseType property
az sql vm update -n  -g  --license-type AHUB
EX: az sql vm update -n sqlvm -g myresourcegroup --license-type AHUB

If you have recently created your SQL VM through Azure Portal or if you updated any SQL Configuration for an existing SQL VM through Azure Portal then your SQL VM is already registered with SQL VM RP. In this case, you should only run the Azure SQL VM Update CLI command to update the license type from PAYG to AHUB. If the original VM was created from PAYG SQL Server image on Azure Marketplace, then you can update the license type to AHUB and back to PAYG any time without any limitation. If the original VM is not created from a PAYG SQL Server image but SQL Server was self-installed or deployed from a BYOL SQL Server image, then you cannot convert the license type to PAYG.

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.

WE ARE MICROSOFT

Explore Microsoft Foundry

The future of AI starts here. Envision your next great AI app with the latest technologies. Get started with Azure.