Infrastructure as a Service Series: Running SQL Server in a Windows Azure Virtual Machine

On June 6, 2012 we announced some great new features in Windows Azure that are now available for preview, including the new Windows Azure Virtual Machines (VM). One of the greatest things about Windows Azure Virtual Machines is they leverage the capabilities of your storage account, meaning OS and disk drives are automatically persisted in Windows Azure by default and you have the option for geo replication. This makes the Windows Azure Virtual Machine an ideal solution for migrating your on premise database applications to Windows Azure, without having to modify the application. In addition, with the exception of a few features during the preview period, which we will discuss further below, you can utilize all of the features available in SQL Server 2012 within the VM. The support for full SQL Server functionality makes the Windows Azure Virtual Machine an ideal solution for the following database scenarios including:

Migrating your existing on-premises SQL Server applications

Developing and testing new database applications quickly and cost effectively

Extending your on-premises database applications to Windows Azure – for example have a portion of the application and data running on a Virtual Machine in Windows Azure for scale scenarios and connecting back to the core on-premises application and data for compliance reasons.

During the preview period you will have access to an image in the gallery with the SQL Server 2012 Evaluation edition to try out running SQL Server in a Windows Azure VM. During the preview period, Database Mirroring, Log Shipping, Transaction Replication & Backup Restore features will be supported, however, SQL Server 2012 AlwaysOn Availability Groups and Clustering will not be supported. By the time Virtual Machines move from a preview state to general availability (GA) AlwaysOn Availability groups will be supported, leaving only the need for Failover Clustering Instance support. Outside of this one feature, by GAGeneral Availability of Windows Azure Virtual Machine you will have the full feature and functionality of SQL Server 2012 within Virtual Machines.

Now let’s discuss further the 4 key scenarios for running SQL Server within a Windows Azure Virtual Machine.

1. Migrating your existing on-premises SQL Server applications

Our enterprise customers today likely have applications that are not yet virtualized and would like to virtualize them. In moving your existing applications, we recommend starting with your departmental Tier 2 and Tier 3 applications. If the application is not yet virtualized, you can use System Center 2012 to virtualize the applications to Windows Server Hyper-V .vhd format, alternatively if your application is already virtualized on another virtualization technology you can use System Center 2012 to convert the already virtualized application to Windows Server Hyper-V .vhd format. Either way System Center 2012 makes this process very easy for you. Once the application is in the proper format you can either transfer just the database to the Windows Azure Virtual Machine or alternatively move the entire on-premises VHD to the Windows Azure VM.

Here are the steps to transfer just the database:

Step 1: You need to identify which database(s) to move using the free toolkit called Microsoft Assessment and Planning (MAP) Toolkit. Then you need to provision a new virtual machine using one of the stock SQL Server images using the Windows Azure Management Preview Portal.

Step 2: You can create a database deployment package using SQL Server Management Studio for the on-prem database(s) or use Database Export/Import Wizard to move the database(s) to SQL Server in a Windows Azure Virtual Machine.

Step 3: You need to configure security on both the Windows Azure Preview Portal endpoint as well as setting an inbound port in the virtual machine’s Windows Firewall. Then you can import the database(s) using the deployment package or using Database Export/Import Wizard.

Step 4: Once you have done that, you can monitor the virtual machine using the Windows Azure Preview Portal and monitor the SQL Server application using SQL Server Management Studio.

Here are the steps to move the entire VHD:

Step 1: You need to identify which database(s) to move using free toolkit called Microsoft Assessment and Planning (MAP) Toolkit.

Step 2: You need to convert your database applications into Hyper-V .vhd format. System Center Virtual Machine Manager is able to perform physical to virtual conversion (P2V) or virtual to virtual conversion (V2V). After that, you can upload the VHD to Windows Azure storage using csupload, vhdctrl, or any other Windows Azure Storage Explorer tools that are available in the market. Make sure that you enable Remote Desktop in the VHD beforehand, convert the VHD into fixed VHD, and upload as page blob.

Step 3: You can then create a virtual machine using the uploaded VHD. Then you need to configure security on both the Windows Azure Preview Portal endpoint as well as setting an inbound port in the virtual machine’s Windows Firewall.

Step 4: Once you have done that, you can monitor the virtual machine using the Windows Azure Preview Portal and monitor the SQL Server application using SQL Server Management Studio

2. Developing and testing

For development and testing in a Windows Azure Virtual Machine you start by using the same on-premise SQL Server Data Tools that you are familiar with to develop your application, than you upload the database application to the Virtual Machine and deploy the VM to start testing the application. You can later decide to take the application back on premise without having to modify the application.

Here are the steps to develop and test a new application:

Step 1: You need to provision a new virtual machine using one of the stock SQL Server images using the Windows Azure Preview Portal.

Step 2: You can then use SQL Server Data Tools to develop new applications. Then you can create a database deployment package using SQL Server Management Studio for the on-prem database(s) or use Database Export/Import Wizard to move the database(s) to SQL Server in a Windows Azure Virtual Machine.

Step 3: You need to configure security on both the Windows Azure Preview Portal endpoint as well as setting an inbound port in the virtual machine’s Windows Firewall. Then you can import the database(s) using the deployment package or using Database Export/Import Wizard.

Step 4: Once you have done that, you can monitor the virtual machine using the Windows Azure Preview Portal and monitor the SQL Server application using SQL Server Management Studio.

To Backup Database or entire VMs to the cloud you start by creating your back up files using SQL Server Management Studio and once the backup files are create you simply transfer them to Windows Azure storage using the Windows Azure Preview Portal. It’s that simple.

Here are the steps to do backup:

Step 1: You need to identify which database(s) to back up. Then you need to provision a new Windows Azure Storage account using the Windows Azure Management Portal.

To extend your on-premises applications to an application running in a Windows Azure Virtual Machine you can take advantage of the new Windows Azure Virtual Network feature that allows you to securely domain join your Windows Azure network running the VM to your on premise network. This allows you to have seamless authentication for your end user with your existing on premises Active Directory identity store. This scenario lets you take advantage of the global reach and cost effectiveness of Windows Azure while still being able to comply with any local, industry or corporate data compliance laws.

Here are the steps to extend an application:

Step 1: You can provision a VPN connection between on-prem and Windows Azure using Windows Azure Virtual Network. Then you need to provision a new virtual machine using one of the stock SQL Server images using the Windows Azure Preview Portal.

Step 2: You can then use SQL Server Data Tools to modify applications to point to SQL Server in a Windows Azure Virtual Machine. Then you can create a database deployment package using SQL Server Management Studio for the on-prem database(s) or use Database Export/Import Wizard to move the database(s) to SQL Server in a Windows Azure Virtual Machine.

Step 3: You need to configure security on both the Windows Azure Preview Portal endpoint as well as setting an inbound port in the virtual machine’s Windows Firewall. Then you can import the database(s) using the deployment package or using Database Export/Import Wizard.

Step 4: Once you have done that, you can monitor the virtual machine using the Windows Azure Preview Portal and monitor the SQL Server application using SQL Server Management Studio.

If you haven’t already, try out the SQL Server 2012 evaluation edition available now in the Windows Azure Virtual Machine preview. Learn more about the new Windows Azure Virtual Machine here. In addition you will find the following guides useful for running SQL Server on a Windows Azure Virtual Machine: