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.
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.
The SQL Server IaaS Agent Extension supports the following administration tasks:
|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.
Requirements to use the SQL Server IaaS Agent Extension on your VM:
- Windows Server 2012
- Windows Server 2012 R2
- Windows Server 2016
SQL Server versions:
- SQL Server 2012
- SQL Server 2014
- SQL Server 2016
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.
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.
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"
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.
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.
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.
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
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.
You can also use the Remove-AzVMSqlServerExtension PowerShell cmdlet.
Remove-AzVMSqlServerExtension -ResourceGroupName "resourcegroupname" -VMName "vmname" -Name "SqlIaasExtension"
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.
We'd love to hear your thoughts. Choose the type you'd like to provide:
Our feedback system is built on GitHub Issues. Read more on our blog.