Automate management tasks on Azure Virtual Machines with the SQL Server Agent Extension (Resource Manager)

The SQL Server IaaS Agent Extension (SqlIaasExtension) runs on Azure virtual machines to automate administration tasks. This article provides an overview of the services supported by the extension as well as instructions for installation, status, and removal.

Note

Azure has two different deployment models for creating and working with resources: Resource Manager and classic. This article covers using the Resource Manager deployment model, which Microsoft recommends for new deployments instead of the classic deployment model.

To view the classic version of this article, see SQL Server Agent Extension for SQL Server VMs Classic.

Supported services

The SQL Server IaaS Agent Extension supports the following administration tasks:

Administration feature Description
SQL Automated Backup Automates the scheduling of backups for all databases for the default instance of SQL Server in the VM. For more information, see Automated backup for SQL Server in Azure Virtual Machines (Resource Manager).
SQL Automated Patching Configures a maintenance window during which important Windows updates to your VM can take place, so you can avoid updates during peak times for your workload. For more information, see Automated patching for SQL Server in Azure Virtual Machines (Resource Manager).
Azure Key Vault Integration Enables you to automatically install and configure Azure Key Vault on your SQL Server VM. For more information, see Configure Azure Key Vault Integration for SQL Server on Azure VMs (Resource Manager).

Once installed and running, the SQL Server IaaS Agent Extension makes these administration features available on the SQL Server panel of the virtual machine in the Azure portal and through Azure PowerShell for SQL Server marketplace images, and through Azure PowerShell for manual installations of the extension.

Prerequisites

Requirements to use the SQL Server IaaS Agent Extension on your VM:

Operating System:

  • Windows Server 2012
  • Windows Server 2012 R2
  • Windows Server 2016

SQL Server versions:

  • SQL Server 2012
  • SQL Server 2014
  • SQL Server 2016

Azure PowerShell:

Note

This article has been updated to use the new Azure PowerShell Az module. To learn more about the new Az module and AzureRM compatibility, see Introducing the new Azure PowerShell Az module. For installation instructions, see Install Azure PowerShell.

Important

At this time, the SQL Server IaaS Agent Extension is not supported for SQL Server FCI on Azure. We recommend that you uninstall the extension from VMs that participate in an FCI. The features supported by the extension are not available to the SQL VMs after the agent is uninstalled.

Installation

The SQL Server IaaS Agent Extension is automatically installed when you provision one of the SQL Server virtual machine gallery images. If you need to reinstall the extension manually on one of these SQL Server VMs, use the following PowerShell command:

Set-AzVMSqlServerExtension -ResourceGroupName "resourcegroupname" -VMName "vmname" -Name "SqlIaasExtension" -Version "2.0" -Location "East US 2"

Important

If the extension is not already installed, installing the extension restarts the SQL Server service. However, updating the SQL IaaS extension does not restart the SQL Server service.

Note

The SQL Server IaaS Agent Extension is only supported on SQL Server VM gallery images (pay-as-you-go or bring-your-own-license). It is not supported if you manually install SQL Server on an OS-only Windows Server virtual machine or if you deploy a customized SQL Server VM VHD. In these cases, it might be possible to install and manage the extension manually by using PowerShell, but you do not get the SQL Server configuration settings in the Azure portal. However, it is strongly recommended to instead install a SQL Server VM gallery image and then customize it.

Status

One way to verify that the extension is installed is to view the agent status in the Azure portal. Select All settings in the virtual machine window, and then click on Extensions. You should see the SqlIaasExtension extension listed.

SQL Server IaaS Agent Extension in Azure portal

You can also use the Get-AzVMSqlServerExtension Azure PowerShell cmdlet.

Get-AzVMSqlServerExtension -VMName "vmname" -ResourceGroupName "resourcegroupname"

The previous command confirms the agent is installed and provides general status information. You can also get specific status information about Automated Backup and Patching with the following commands.

$sqlext = Get-AzVMSqlServerExtension -VMName "vmname" -ResourceGroupName "resourcegroupname"
$sqlext.AutoPatchingSettings
$sqlext.AutoBackupSettings

Removal

In the Azure Portal, you can uninstall the extension by clicking the ellipsis on the Extensions window of your virtual machine properties. Then click Delete.

Uninstall the SQL Server IaaS Agent Extension in Azure portal

You can also use the Remove-AzVMSqlServerExtension PowerShell cmdlet.

Remove-AzVMSqlServerExtension -ResourceGroupName "resourcegroupname" -VMName "vmname" -Name "SqlIaasExtension"

Next steps

Begin using one of the services supported by the extension. For more details, see the articles referenced in the Supported services section of this article.

For more information about running SQL Server on Azure Virtual Machines, see SQL Server on Azure Virtual Machines overview.