Automatic registration with SQL IaaS Agent extension
Applies to: SQL Server on Azure VM
Enable the automatic registration feature in the Azure portal to automatically register all current and future SQL Server on Azure Virtual Machines (VMs) with the SQL IaaS Agent extension in lightweight mode. By default, Azure VMs that have SQL Server 2016 or later installed will be automatically registered with the SQL IaaS Agent extension when detected by the CEIP service. See the SQL Server privacy supplement for more information.
October 2022 introduced the least privileged model for the SQL Server IaaS Agent extension. SQL Server VMs deployed via the Azure marketplace after this date have the least privileged model enabled by default. To learn more, review SQL IaaS extension permissions
Registering your SQL Server VM with the SQL IaaS Agent extension to unlock a full feature set of benefits.
When automatic registration is enabled, a job runs monthly to detect whether or not SQL Server is installed on all the unregistered VMs in the subscription. This is done by copying the SQL IaaS agent extension binaries to the VM, then running a one-time utility that checks for the SQL Server registry hive. If the SQL Server hive is detected, the virtual machine is registered with the extension in lightweight mode. If no SQL Server hive exists in the registry, the binaries are removed.
If the SQL Server hive is not present in the registry, removing the binaries might be impacted if there are resource locks in place.
Once automatic registration is enabled for a subscription, all current and future VMs that have SQL Server installed will be registered with the SQL IaaS Agent extension in lightweight mode without downtime, and without restarting the SQL Server service. You still need to manually upgrade to full manageability mode to take advantage of the full feature set. The license type automatically defaults to that of the VM image. If you use a pay-as-you-go image for your VM, then your license type will be
PAYG, otherwise your license type will be
AHUB by default.
By default, Azure VMs with SQL Server 2016 or later installed will be automatically registered with the SQL IaaS Agent extension when detected by the CEIP service. See the SQL Server privacy supplement for more information.
The SQL IaaS Agent extension collects data for the express purpose of giving customers optional benefits when using SQL Server within Azure Virtual Machines. Microsoft will not use this data for licensing audits without the customer's advance consent. See the SQL Server privacy supplement for more information.
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:
- Moving all pay-as-you-go (full price) SQL PaaS/IaaS workloads to take advantage of your Hybrid Benefits without individually configuring them to enable Azure Hybrid Benefit
- Ensuring that all your SQL workloads are licensed in compliance with the existing license agreements.
- Separating the license compliance management roles from devops roles using RBAC
- Take advantage of free business continuity by ensuring that your passive & DR environments are properly identified.
- Leverage your 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 the 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 are not registered with the SQL IaaS Agent extension when CM-AHB is enabled by your billing admin, the service will not receive the full usage data from your Azure subscriptions and therefore the CM-AHB recommendations will be inaccurate.
If automatic registration is activated after CM-AHB is enabled, you will run the risk of unnecessary pay-as-you-go charges for your SQL Server on Azure VM workloads. To mitigate this risk, you need to 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.
To register your SQL Server VM with the extension, you'll need:
- An Azure subscription and, at minimum, contributor role permissions.
- An Azure Resource Model Windows Server 2008 R2 (or later) virtual machine with SQL Server deployed to the public or Azure Government cloud. Windows Server 2008 is not supported.
- The client credentials used to register the virtual machines exist in any of the following Azure roles: Virtual Machine contributor, Contributor, or Owner.
To enable automatic registration of your SQL Server VMs in the Azure portal, follow these steps:
Sign into the Azure portal.
Navigate to the SQL virtual machines resource page.
Select Automatic SQL Server VM registration to open the Automatic registration page.
Choose your subscription from the drop-down.
Read through the terms and if you agree, select I accept.
Select Register to enable the feature and automatically register all current and future SQL Server VMs with the SQL IaaS Agent extension. This will not restart the SQL Server service on any of the VMs.
Use the Azure CLI or Azure PowerShell to disable the automatic registration feature. When the automatic registration feature is disabled, SQL Server VMs added to the subscription need to be manually registered with the SQL IaaS Agent extension. This will not unregister existing SQL Server VMs that have already been registered.
To disable automatic registration using Azure CLI, run the following command:
az feature unregister --namespace Microsoft.SqlVirtualMachine --name BulkRegistration
Enable for multiple subscriptions
You can enable the automatic registration feature for multiple Azure subscriptions by using PowerShell.
To do so, follow these steps:
Save this script.
Navigate to where you saved the script by using an administrative Command Prompt or PowerShell window.
Connect to Azure (
Execute the script, passing in SubscriptionIds as parameters. If no subscriptions are specified, the script will enable auto-registration for all the subscriptions in the user account.
The following command will enable auto-registration for two subscriptions:
.\EnableBySubscription.ps1 -SubscriptionList a1a1a-aa11-11aa-a1a1-a11a111a1,b2b2b2-bb22-22bb-b2b2-b2b2b2bb
The following command will enable auto-registration for all subscriptions:
Failed registration errors are stored in
RegistrationErrors.csv located in the same directory where you saved and executed the
.ps1 script from.
Upgrade your manageability mode to full to take advantage of the full feature set provided to you by the SQL IaaS Agent extension