Dışarıya aktar (0) Yazdır
Tümünü Genişlet
Bu içerik dilinizde bulunmamaktadır ancak İngilizce sürümüne buradan bakabilirsiniz.

How to create a SQL Server virtual machine in Azure using the existing on-premises SQL Server virtual machine

Updated: February 28, 2014

This topic describes how to create a SQL Server virtual machine in Azure using the existing on-premises SQL Server virtual machine.

  1. Create a Windows Server virtual machine by using the steps provided in the How to create a base virtual machine on-premises using Hyper-V.

  2. Then, prepare the SQL Server Setup Media to be visible to this new virtual machine.

    To prepare the SQL Server Setup media, you can follow one of the following two methods:

    • Prepare SQL Server setup media by using .iso file:

      • Download the Windows Automation Tool for Windows. Save KB3AIK_EN.iso to your local computer.

      • You may use any third-party tool to extract the contents of iso file. After extracting the contents of the KB3AIK_EN.iso file to your local computer, run the wAIKAMD64.msi to install the Windows Automation Tool.

      • Then, click Start, point to All Programs, then point to Microsoft Windows AIK. Click Deployment Tools command prompt.

      • Run the oscdimg tool to create .ISO file, which includes the SQL Server setup files:C:\Program Files\Windows AIK\Tools\PETools>oscdimg -n -o F:\Enterprise C:\SQLServerSetup.iso

      • Then, mount the ISO image of the SQL Server Setup to the new virtual machine. To do that, right-click on the virtual machine that you created via the Hyper-V Manager.

      • Choose Settings. Select DVD Drive. Choose Image File option. Browse to the folder, which has SQLServerSetup.ISO file. Click OK.

    • Prepare SQL Server setup media by using virtual hard disk: Create a new virtual hard disk on-premises (F:\ volume) by following the steps described at the Create a virtual hard drive (VHD) file on your server section of the How to copy SQL Server data and setup files in a data disk from on-premises to AzureAzure topic. Then, copy the SQL Server setup files to this additional disk. Then, detach this VHD from your on-premises computer by following the steps described at the Copy SQL Server data files or setup bits to the VHD file section of the same topic. Then, shut down the virtual machine. In the Hyper-V Manager, open the Settings window of the virtual machine. Choose IDE Controller 0. Choose Hard Drive. Click Add. Browse to the SQLSetupBits.vhd. Click OK. Connect to the virtual machine. Start the virtual machine.

  3. Connect to the virtual machine using Hyper-V Manager.

  4. In the Windows Explorer, you should be able to see the new DVD drive or the new drive, which includes the SQL Server setup files.

  5. Then, double-click the setup.exe to install SQL Server in the new virtual machine. During setup, take a note of the SQL Server license key. You will need it when you complete the setup after uploading the virtual machine to Azure. In the SQL Server Installation Center window, click Advanced. Click Image preparation of a stand-alone instance of SQL Server and complete the setup. This process will run the SQL Server Sysprep to allow you to prepare a stand-alone instance of SQL Server on a computer and to complete the configuration at a later time. This step stops the installation process after the product binaries are installed, without configuring the computer, network, or account-specific information for the instance of SQL Server that is being prepared. For more information, see Install SQL Server 2014 Using SysPrep and Considerations for Installing SQL Server Using SysPrep.

  6. Before uploading any virtual machine VHD file to Azure, make sure that the remote desktop is enabled. Because Windows Firewall restricts communication between your computer and the Internet, you might need to change settings for Remote Desktop Connection so that it can work properly. When using Windows Server 2008 R2, open You can find detailed information on how to enable remote desktop connection at Enable Remote Desktop. In addition, you must remove the virtual machine from your on-premises network if it is connected already. For more information, see Remove a computer from a Windows domain.

  7. Before the virtual machine image can be uploaded to Azure, it must be generalized by using the Sysprep command. In the virtual machine, open a Command Prompt window as an administrator. Change the directory to %windir%\system32\sysprep, and then run sysprep.exe. The System Preparation Tool dialog box appears. In System Cleanup Action, select Enter System Out-of-Box Experience (OOBE) and make sure that Generalize is checked. In Shutdown Options, select Shutdown. Click OK.

  8. To upload the virtual machine VHD file to the Management Portal as a persistent image, follow the instructions given in the Upload the VHD file to Azure using Add-AzureVHD section of the How to copy SQL Server data and setup files in a data disk from on-premises to Azure topic. Simply, open up the Azure PowerShell window, connect to your subscription, and run the Add-AzureVHD cmdlet. The following is an example code that shows how to use the Add-AzureVHD cmdlet:

    Add-AzureVhd -Destination <BlobStorageURL>/<YourImagesFolder>/<VHDName> -LocalFilePath <PathToVHDFile>

    Where BlobStorageURL is the URL for the storage account that you created earlier. You can place the VHD file anywhere within your Blog storage. YourImagesFolder is the container within blob storage where you want to store your images. VHDName is the label that appears in the Azure Platform Management Portal to identify the VHD. PathToVHDFile is the full path and name of the VHD file.

    The upload process might take a few minutes.

  9. Then, log on to the Management Portal. Click Virtual Machines, click Images, and then click Create. In Create an image from a VHD, specify a name (such as, “SQLImageSysPrep1”) and URL to the .vhd that you uploaded. Check I have run Sysprep on the virtual machine associated with this VHD to acknowledge that you generalized the operating system earlier, and then click OK. You can create multiple virtual machines in Azure by using this new image.

  10. Next, provision a new virtual machine using this image. Click Virtual Machines, New, Compute, Virtual Machine, From Gallery, My Images. Choose the new image, (such as “SQLImageSysPrep1”). Follow the instructions given in the Provisioning a SQL Server Virtual Machine on Azure article to create a virtual machine.

  11. After the provisioning is complete, you can connect to your new virtual machine by using remote desktop and complete the configuration of a prepared instance of SQL Server. For more information, follow the instructions given in the Install SQL Server 2014 Using SysPrep topic.

See Also

Topluluk İçeriği

© 2014 Microsoft