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 you can use to create and work with resources: Azure Resource Manager and classic. This article covers the use of the Resource Manager deployment model. We recommend the Resource Manager deployment model 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 either the default instance or a properly installed named instance of SQL Server on 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 2008 R2
- Windows Server 2012
- Windows Server 2012 R2
- Windows Server 2016
- Windows Server 2019
SQL Server versions:
- SQL Server 2008
- SQL Server 2008 R2
- SQL Server 2012
- SQL Server 2014
- SQL Server 2016
- SQL Server 2017
This article has been updated to use the new Azure PowerShell Az module. You can still use the AzureRM module, which will continue to receive bug fixes until at least December 2020. To learn more about the new Az module and AzureRM compatibility, see Introducing the new Azure PowerShell Az module. For Az module 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. The SQL IaaS extension offers manageability for a single instance on the SQL Server VM. If there is a default instance, then the extension will work with the default instance, and it will not support managing other instances. If there is no default instance but only one named instance, then it will manage the named instance. If there is no default instance and there are multiple named instances, then the extension will fail to install.
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.
While it is possible to install the SQL Server IaaS Agent extension to custom SQL Server images, the functionality is currently limited to changing the license type. Other features provided by the SQL IaaS extension will only work on SQL Server VM gallery images (pay-as-you-go or bring-your-own-license).
Use a single named instance
The SQL IaaS extension will work with a named instance on a SQL Server image if the default instance is uninstalled properly, and if the IaaS extension is reinstalled.
To use a named instance of SQL Server, do the following:
- Deploy a SQL Server VM from the marketplace.
- Uninstall the IaaS extension from within the Azure portal.
- Uninstall SQL Server completely within the SQL Server VM.
- Install SQL Server with a named instance within the SQL Server VM.
- Install the IaaS extension from within the Azure portal.
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.
Send feedback about: