Frequently asked questions for SQL Server on Azure VMs

APPLIES TO: SQL Server on Azure VM

This article provides answers to some of the most common questions about running SQL Server on Windows Azure Virtual Machines (VMs).

If your Azure issue is not addressed in this article, visit the Azure forums on MSDN and Stack Overflow. You can post your issue in these forums, or post to @AzureSupport on Twitter. You also can submit an Azure support request. To submit a support request, on the Azure support page, select Get support.

Images

  1. What SQL Server virtual machine gallery images are available?

    Azure maintains virtual machine images for all supported major releases of SQL Server on all editions for both Windows and Linux. For more information, see the complete list of Windows VM images and Linux VM images.

  2. Are existing SQL Server virtual machine gallery images updated?

    Every two months, SQL Server images in the virtual machine gallery are updated with the latest Windows and Linux updates. For Windows images, this includes any updates that are marked important in Windows Update, including important SQL Server security updates and service packs. For Linux images, this includes the latest system updates. SQL Server cumulative updates are handled differently for Linux and Windows. For Linux, SQL Server cumulative updates are also included in the refresh. But at this time, Windows VMs are not updated with SQL Server or Windows Server cumulative updates.

  3. Can SQL Server virtual machine images get removed from the gallery?

    Yes. Azure only maintains one image per major version and edition. For example, when a new SQL Server service pack is released, Azure adds a new image to the gallery for that service pack. The SQL Server image for the previous service pack is immediately removed from the Azure portal. However, it is still available for provisioning from PowerShell for the next three months. After three months, the previous service pack image is no longer available. This removal policy would also apply if a SQL Server version becomes unsupported when it reaches the end of its lifecycle.

  4. Is it possible to deploy an older image of SQL Server that is not visible in the Azure portal?

    Yes, by using PowerShell. For more information about deploying SQL Server VMs using PowerShell, see How to provision SQL Server virtual machines with Azure PowerShell.

  5. Is it possible to create a generalized Azure Marketplace SQL Server image of my SQL Server VM and use it to deploy VMs?

    Yes, but you must then register each SQL Server VM with the SQL IaaS Agent extension to manage your SQL Server VM in the portal, as well as utilize features such as automated patching and automatic backups. When registering with the extension, you will also need to specify the license type for each SQL Server VM.

  6. How do I generalize SQL Server on Azure VM and use it to deploy new VMs?

    You can deploy a Windows Server VM (without SQL Server installed on it) and use the SQL sysprep process to generalize SQL Server on Azure VM (Windows) with the SQL Server installation media. Customers who have Software Assurance can obtain their installation media from the Volume Licensing Center. Customers who don't have Software Assurance can use the setup media from an Azure Marketplace SQL Server VM image that has the desired edition.

    Alternatively, use one of the SQL Server images from Azure Marketplace to generalize SQL Server on Azure VM. Note that you must delete the following registry key in the source image before creating your own image. Failure to do so can result in the bloating of the SQL Server setup bootstrap folder and/or SQL IaaS extension in failed state.

    Registry Key path:
    Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\SysPrepExternal\Specialize

    Note

    SQL Server on Azure VMs, including those deployed from custom generalized images, should be registered with the SQL IaaS Agent extension to meet compliance requirements and to utilize optional features such as automated patching and automatic backups. The extension also allows you to specify the license type for each SQL Server VM.

  7. Can I use my own VHD to deploy a SQL Server VM?

    Yes, but you must then register each SQL Server VM with the SQL IaaS Agent extension to manage your SQL Server VM in the portal, as well as utilize features such as automated patching and automatic backups.

  8. Is it possible to set up configurations not shown in the virtual machine gallery (for example Windows 2008 R2 + SQL Server 2012)?

    No. For virtual machine gallery images that include SQL Server, you must select one of the provided images either through the Azure portal or via PowerShell. However, you have the ability to deploy a Windows VM and self-install SQL Server to it. You must then register your SQL Server VM with the SQL IaaS Agent extension to manage your SQL Server VM in the Azure portal, as well as utilize features such as automated patching and automatic backups.

Creation

  1. How do I create an Azure virtual machine with SQL Server?

    The easiest method is to create a virtual machine that includes SQL Server. For a tutorial on signing up for Azure and creating a SQL Server VM from the portal, see Provision a SQL Server virtual machine in the Azure portal. You can select a virtual machine image that uses pay-per-second SQL Server licensing, or you can use an image that allows you to bring your own SQL Server license. You also have the option of manually installing SQL Server on a VM with either a freely licensed edition (Developer or Express) or by reusing an on-premises license. Be sure to register your SQL Server VM with the SQL IaaS Agent extension to manage your SQL Server VM in the portal, as well as utilize features such as automated patching and automatic backups. If you bring your own license, you must have License Mobility through Software Assurance on Azure. For more information, see Pricing guidance for SQL Server Azure VMs.

  2. How can I migrate my on-premises SQL Server database to the cloud?

    First create an Azure virtual machine with a SQL Server instance. Then migrate your on-premises databases to that instance. For data migration strategies, see Migrate a SQL Server database to SQL Server in an Azure VM.

Licensing

  1. How can I install my licensed copy of SQL Server on an Azure VM?

    There are three ways to do this. If you're an Enterprise Agreement (EA) customer, you can provision one of the virtual machine images that supports licenses, which is also known as bring-your-own-license (BYOL). If you have Software Assurance, you can enable the Azure Hybrid Benefit on an existing pay-as-you-go (PAYG) image. Or you can copy the SQL Server installation media to a Windows Server VM, and then install SQL Server on the VM. Be sure to register your SQL Server VM with the extension for features such as portal management, automated backup and automated patching.

  2. Can I change a VM to use my own SQL Server license if it was created from one of the pay-as-you-go gallery images?

    Yes. You can easily switch a pay-as-you-go (PAYG) gallery image to bring-your-own-license (BYOL) by enabling the Azure Hybrid Benefit. For more information, see How to change the licensing model for a SQL Server VM. Currently, this facility is only available for public and Azure Government cloud customers.

  3. Will switching licensing models require any downtime for SQL Server?

    No. Changing the licensing model does not require any downtime for SQL Server as the change is effective immediately and does not require a restart of the VM. However, to register your SQL Server VM with the SQL IaaS Agent extension, the SQL IaaS extension is a prerequisite and installing the SQL IaaS extension in full mode restarts the SQL Server service. As such, if the SQL IaaS extension needs to be installed, either install it in lightweight mode for limited functionality, or install it in full mode during a maintenance window. The SQL IaaS extension installed in lightweight mode can be upgraded to full mode at any time, but requires a restart of the SQL Server service.

  4. Is it possible to switch licensing models on a SQL Server VM deployed using classic model?

    No. Changing licensing models is not supported on a classic VM. You may migrate your VM to the Azure Resource Manager model and register with the SQL IaaS Agent extension. Once the VM is registered with the SQL IaaS Agent extension, licensing model changes will be available on the VM.

  5. Can I use the Azure portal to manage multiple instances on the same VM?

    No. Portal management is a feature provided by the SQL IaaS Agent extension, which relies on the SQL Server IaaS Agent extension. As such, the same limitations apply to the extension as to the extension. The portal can either only manage one default instance, or one named instance, as long as it was configured correctly. For more information on these limitations, see SQL Server IaaS agent extension.

  6. Can CSP subscriptions activate the Azure Hybrid Benefit?

    Yes, the Azure Hybrid Benefit is available for CSP subscriptions. CSP customers should first deploy a pay-as-you-go image, and then change the licensing model to bring-your-own-license.

  7. Do I have to pay to license SQL Server on an Azure VM if it is only being used for standby/failover?

    To have a free passive license for a standby secondary availability group or failover clustered instance, you must meet all of the following criteria as outlined by the Product Licensing Terms:

    1. You have license mobility through Software Assurance.
    2. The passive SQL Server instance does not serve SQL Server data to clients or run active SQL Server workloads. It is only used to synchronize with the primary server and otherwise maintain the passive database in a warm standby state. If it is serving data, such as reports to clients running active SQL Server workloads, or performing any work other than what is specified in the product terms, it must be a paid licensed SQL Server instance. The following activity is permitted on the secondary instance: database consistency checks or CheckDB, full backups, transaction log backups, and monitoring resource usage data. You may also run the primary and corresponding disaster recovery instance simultaneously for brief periods of disaster recovery testing every 90 days.
    3. The active SQL Server license is covered by Software Assurance and allows for one passive secondary SQL Server instance, with up to the same amount of compute as the licensed active server, only.
    4. The secondary SQL Server VM utilizes the Disaster Recovery license in the Azure portal.
  8. What is considered a passive instance?

    The passive SQL Server instance does not serve SQL Server data to clients or run active SQL Server workloads. It is only used to synchronize with the primary server and otherwise maintain the passive database in a warm standby state. If it is serving data, such as reports to clients running active SQL Server workloads, or performing any work other than what is specified in the product terms, it must be a paid licensed SQL Server instance. The following activity is permitted on the secondary instance: database consistency checks or CheckDB, full backups, transaction log backups, and monitoring resource usage data. You may also run the primary and corresponding disaster recovery instance simultaneously for brief periods of disaster recovery testing every 90 days.

  9. What scenarios can utilize the Disaster Recovery (DR) benefit?

    The licensing guide provides scenarios in which the Disaster Recovery Benefit can be utilized. Refer to your Product Terms and talk to your licensing contacts or account manager for more information.

  10. Which subscriptions support the Disaster Recovery (DR) benefit?

    Comprehensive programs that offer Software Assurance equivalent subscription rights as a fixed benefit support the DR benefit. This includes. but is not limited to, the Open Value (OV), Open Value Subscription (OVS), Enterprise Agreement (EA), Enterprise Agreement Subscription (EAS), and the Server and Cloud Enrollment (SCE). Refer to the product terms and talk to your licensing contacts or account manager for more information.

Extension

  1. Will registering my VM with the new SQL IaaS Agent extension bring additional costs?

    No. The SQL IaaS Agent extension just enables additional manageability for SQL Server on Azure VM with no additional charges.

  2. Is the SQL IaaS Agent extension available for all customers?

    Yes, as long as the SQL Server VM was deployed on the public cloud using the Resource Manager model, and not the classic model. All other customers are able to register with the new SQL IaaS Agent extension. However, only customers with the Software Assurance benefit can use their own license by activating the Azure Hybrid Benefit (AHB) on a SQL Server VM.

  3. What happens to the extension (Microsoft.SqlVirtualMachine) resource if the VM resource is moved or dropped?

    When the Microsoft.Compute/VirtualMachine resource is dropped or moved, then the associated Microsoft.SqlVirtualMachine resource is notified to asynchronously replicate the operation.

  4. What happens to the VM if the extension (Microsoft.SqlVirtualMachine) resource is dropped?

    The Microsoft.Compute/VirtualMachine resource is not impacted when the Microsoft.SqlVirtualMachine resource is dropped. However, the licensing changes will default back to the original image source.

  5. Is it possible to register self-deployed SQL Server VMs with the SQL IaaS Agent extension?

    Yes. If you deployed SQL Server from your own media, and installed the SQL IaaS extension you can register your SQL Server VM with the extension to get the manageability benefits provided by the SQL IaaS extension.

Administration

  1. Can I install a second instance of SQL Server on the same VM? Can I change installed features of the default instance?

    Yes. The SQL Server installation media is located in a folder on the C drive. Run Setup.exe from that location to add new SQL Server instances or to change other installed features of SQL Server on the machine. Note that some features, such as Automated Backup, Automated Patching, and Azure Key Vault Integration, only operate against the default instance, or a named instance that was configured properly (See Question 3). Customers using Software Assurance through the Azure Hybrid Benefit or the pay-as-you-go licensing model can install multiple instances of SQL Server on the virtual machine without incurring extra licensing costs. Additional SQL Server instances may strain system resources unless configured correctly.

  2. What is the maximum number of instances on a VM? SQL Server 2012 to SQL Server 2019 can support 50 instances on a stand-alone server. This is the same limit regardless of in Azure on-premises. See best practices to learn how to better prepare your environment.

  3. Can I uninstall the default instance of SQL Server?

    Yes, but there are some considerations. First, SQL Server-associated billing may continue to occur depending on the license model for the VM. Second, as stated in the previous answer, there are features that rely on the SQL Server IaaS Agent Extension. If you uninstall the default instance without removing the IaaS extension also, the extension continues to look for the default instance and may generate event log errors. These errors are from the following two sources: Microsoft SQL Server Credential Management and Microsoft SQL Server IaaS Agent. One of the errors might be similar to the following:

    A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible.

    If you do decide to uninstall the default instance, also uninstall the SQL Server IaaS Agent Extension as well.

  4. Can I use a named instance of SQL Server with the IaaS extension?

    Yes, if the named instance is the only instance on the SQL Server, and if the original default instance was uninstalled properly. If there is no default instance and there are multiple named instances on a single SQL Server VM, the SQL Server IaaS agent extension will fail to install.

  5. Can I remove SQL Server and the associated license billing from a SQL Server VM?

    Yes, but you'll need to take additional steps to avoid being charged for your SQL Server instance as described in Pricing guidance. If you want to completely remove the SQL Server instance, you can migrate to another Azure VM without SQL Server pre-installed on the VM and delete the current SQL Server VM. If you want to keep the VM but stop SQL Server billing, follow these steps:

    1. Back up all of your data, including system databases, if necessary.
    2. Uninstall SQL Server completely, including the SQL IaaS extension (if present).
    3. Install the free SQL Express edition.
    4. Register with the SQL IaaS Agent extension in lightweight mode.
    5. (optional) Disable the Express SQL Server service by disabling service startup.
  6. Can I use the Azure portal to manage multiple instances on the same VM?

    No. Portal management is provided by the SQL IaaS Agent extension, which relies on the SQL Server IaaS Agent extension. As such, the same limitations apply to the extension as the extension. The portal can either only manage one default instance, or one named instance as long as its configured correctly. For more information, see SQL Server IaaS Agent extension

Updating and patching

  1. How do I change to a different version/edition of SQL Server in an Azure VM?

    Customers can change their version/edition of SQL Server by using setup media that contains their desired version or edition of SQL Server. Once the edition has been changed, use the Azure portal to modify the edition property of the VM to accurately reflect billing for the VM. For more information, see change edition of a SQL Server VM. There is no billing difference for different versions of SQL Server, so once the version of SQL Server has been changed, no further action is needed.

  2. Where can I get the setup media to change the edition or version of SQL Server?

    Customers who have Software Assurance can obtain their installation media from the Volume Licensing Center. Customers that do not have Software Assurance can use the setup media from an Azure Marketplace SQL Server VM image that has their desired edition.

  3. How are updates and service packs applied on a SQL Server VM?

    Virtual machines give you control over the host machine, including when and how you apply updates. For the operating system, you can manually apply windows updates, or you can enable a scheduling service called Automated Patching. Automated Patching installs any updates that are marked important, including SQL Server updates in that category. Other optional updates to SQL Server must be installed manually.

  4. Can I upgrade my SQL Server 2008 / 2008 R2 instance after registering it with the SQL IaaS Agent extension?

    If the OS is Windows Server 2008 R2 or later, yes. You can use any setup media to upgrade the version and edition of SQL Server, and then you can upgrade your SQL IaaS extension mode) from no agent to full. Doing so will give you access to all the benefits of the SQL IaaS extension such as portal manageability, automated backups, and automated patching. If the OS version is Windows Server 2008, only NoAgent mode is supported.

  5. How can I get free extended security updates for my end of support SQL Server 2008 and SQL Server 2008 R2 instances?

    You can get free extended security updates by moving your SQL Server as-is to an Azure virtual machine. For more information, see end of support options.

General

  1. Are SQL Server failover cluster instances (FCI) supported on Azure VMs?

    Yes. You can install a failover cluster instance using either premium file shares (PFS) or storage spaces direct (S2D) for the storage subsystem. Premium file shares provide IOPS and throughput capacities that will meet the needs of many workloads. For IO-intensive workloads, consider using storage spaces direct based on manged premium or ultra-disks. Alternatively, you can use third-party clustering or storage solutions as described in High availability and disaster recovery for SQL Server on Azure Virtual Machines.

    Important

    At this time, the full SQL Server IaaS Agent Extension is not supported for SQL Server FCI on Azure. We recommend that you uninstall the full extension from VMs that participate in the FCI, and install the extension in lightweight mode instead. This extension supports features, such as Automated Backup and Patching and some portal features for SQL Server. These features will not work for SQL Server VMs after the full agent is uninstalled.

  2. What is the difference between SQL Server VMs and the SQL Database service?

    Conceptually, running SQL Server on an Azure virtual machine is not that different from running SQL Server in a remote datacenter. In contrast, Azure SQL Database offers database-as-a-service. With SQL Database, you do not have access to the machines that host your databases. For a full comparison, see Choose a cloud SQL Server option: Azure SQL (PaaS) Database or SQL Server on Azure VMs (IaaS).

  3. How do I install SQL Data tools on my Azure VM?

    Download and install the SQL Data tools from Microsoft SQL Server Data Tools - Business Intelligence for Visual Studio 2013.

  4. Are distributed transactions with MSDTC supported on SQL Server VMs?

    Yes. Local DTC is supported for SQL Server 2016 SP2 and greater. However, applications must be tested when utilizing Always On availability groups, as transactions in-flight during a failover will fail and must be retried. Clustered DTC is available starting with Windows Server 2019.

Resources

Windows VMs:

Linux VMs: