Register Windows SQL Server VM with SQL IaaS Agent extension

Applies to: SQL Server on Azure VM

Register your SQL Server VM with the SQL IaaS Agent extension to unlock a wealth of feature benefits for your SQL Server on Azure Windows VM.

This article teaches you to register a single SQL Server VM with the SQL IaaS Agent extension. Alternatively, you can register all SQL Server VMs in a subscription automatically or multiple VMs in bulk using a script.

Note

SQL Server VMs deployed via the Azure marketplace after October 2022 have the least privileged model enabled by default. Management modes for the SQL IaaS Agent extension were removed in March 2023.

Overview

Registering with the SQL Server IaaS Agent extension creates the SQL virtual machine resource within your subscription, which is a separate resource from the virtual machine resource. Deleting the extension from your SQL Server VM removes the SQL virtual machine resource but doesn't drop the actual virtual machine.

Deploying a SQL Server VM Azure Marketplace image through the Azure portal automatically registers the SQL Server VM with the extension. However, if you choose to self-install SQL Server on an Azure virtual machine, or provision an Azure virtual machine from a custom VHD, then you must register your SQL Server VM with the SQL IaaS Agent extension to unlock full feature benefits and manageability. 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. For information about privacy, see the SQL IaaS Agent extension privacy statements.

To utilize the SQL IaaS Agent extension, you must first register your subscription with the Microsoft.SqlVirtualMachine provider, which gives the SQL IaaS Agent extension the ability to create resources within that specific subscription. Then you can register your SQL Server VM with the extension.

Prerequisites

To register your SQL Server VM with the extension, you'll need the following:

Register subscription with RP

To register your SQL Server VM with the SQL IaaS Agent extension, you must first register your subscription with the Microsoft.SqlVirtualMachine resource provider (RP). This gives the SQL IaaS Agent extension the ability to create resources within your subscription. You can do so by using the Azure portal, the Azure CLI, or Azure PowerShell.

Register your subscription with the resource provider by using the Azure portal:

  1. Open the Azure portal and go to All Services.

  2. Go to Subscriptions and select the subscription of interest.

  3. On the Subscriptions page, select Resource providers under Settings.

  4. Enter sql in the filter to bring up the SQL-related resource providers.

  5. Select Register, Re-register, or Unregister for the Microsoft.SqlVirtualMachine provider, depending on your desired action.

    Screenshot showing how to modify the provider.

Register with extension

You can manually register your SQL Server VM with the SQL IaaS Agent extension by using Azure PowerShell or the Azure CLI.

Provide the SQL Server license type as either pay-as-you-go (PAYG) to pay per usage, Azure Hybrid Benefit (AHUB) to use your own license, or disaster recovery (DR) to activate the free DR replica license.

It's not currently possible to register your SQL Server VM with the SQL IaaS Agent extension by using the Azure portal.

Verify registration status

You can verify if your SQL Server VM has already been registered with the SQL IaaS Agent extension by using the Azure portal, the Azure CLI, or Azure PowerShell.

Verify the registration status with the Azure portal:

  1. Sign in to the Azure portal.

  2. Go to your SQL Server VMs.

  3. Select your SQL Server VM from the list. If your SQL Server VM isn't listed here, it likely hasn't been registered with the SQL IaaS Agent extension.

  4. View the value under Status. If Status is Succeeded, then the SQL Server VM has been registered with the SQL IaaS Agent extension successfully.

    Screenshot showing how to verify status with SQL RP registration.

Alternatively, you can check the status by choosing Repair under the Support + troubleshooting pane in the SQL virtual machine resource. The provisioning state for the SQL IaaS Agent extension can be Succeeded or Failed.

An error indicates that the SQL Server VM hasn't been registered with the extension.

Delete the extension

To unregister your SQL Server VM with the SQL IaaS Agent extension, delete the SQL virtual machine resource by using the Azure portal, PowerShell, or the Azure CLI. Deleting the SQL virtual machine resource doesn't delete the SQL Server VM.

Warning

Use extreme caution when deleting the extension from your SQL Server VM. Follow the steps carefully because it is possible to inadvertently delete the virtual machine when attempting to remove the resource.

To delete the extension from your SQL Server VM by using the Azure portal, follow these steps:

  1. Sign into the Azure portal.

  2. Navigate to the SQL VM resource.

    Screenshot of SQL virtual machines resource.

  3. Select Delete.

    Screenshot showing how to select delete in the top navigation.

  4. Type the name of the SQL virtual machine and clear the check box next to the virtual machine.

    Screenshot showing how to uncheck the VM to prevent deleting the actual virtual machine, and then select Delete to proceed with deleting the SQL VM resource.

    Warning

    Failure to clear the checkbox next to the virtual machine name will delete the virtual machine entirely. Clear the checkbox to delete the extension from the SQL Server VM but not delete the actual virtual machine.

  5. Select Delete to confirm the deletion of the SQL virtual machine resource, and not the SQL Server VM.

To learn more, review the following articles: