SALG : 1-800-867-1389
EN
Dette indhold er ikke tilgængeligt på dit sprog, men her er den engelske version.

Tutorial: Configure and connect multiple SQL Server virtual machines in the same cloud service in Azure

Updated: October 28, 2013

This tutorial demonstrates how you can configure and connect multiple SQL Server virtual machines in the same cloud service in Azure. Connecting virtual machines in the same cloud service enables them to communicate with each other. When you create a virtual machine, a cloud service is automatically created to contain the machine. All virtual machines that you create in Azure can automatically communicate using a private network channel with other virtual machines in the same cloud service or virtual network.

To connect the virtual machines in the same cloud service, you do not need to create an Azure endpoint for the virtual machine but you need to create a TCP port in the Windows Firewall for the database engine in the virtual machine.

You can select a SQL Server virtual machine image from the gallery and provision the virtual machine to your Azure environment.

In this tutorial, you will:

Provision two SQL Server virtual machines from the gallery

  1. Log in to the Azure Management Portal using your account. If you do not have an Azure account, visit Azure free trial.

  2. On the Azure Management Portal, at the bottom left of the web page, click +NEW, click COMPUTE, and then VIRTUAL MACHINE, and then click FROM GALLERY.

  3. Select a virtual machine image containing SQL Server, and then click the next arrow at the bottom right of the page.

  4. On the Virtual machine configuration page, provide the following information:

    • Type SQLVM1 as a VIRTUAL MACHINE NAME. Note that, in the Azure Portal, when you click a virtual machine name to open its Dashboard, you can see the virtual machine name as a host name.

    • In the NEW USER NAME box, type unique user name for the local administrator account.

    • In the NEW PASSWORD box, type a strong password.

    • In the CONFIRM PASSWORD box, retype the password.

    • Select the appropriate SIZE from the drop down list.

  5. On the Virtual machine mode page, provide the following information:

    • Select Standalone Virtual Machine.

    • In the DNS NAME box, provide the first portion of a DNS name of your choice, so that it completes a name in the format SQLVM2012.cloudapp.net.

    • In the REGION/AFFINITY GROUP/VIRTUAL NETWORK box, select a region where this virtual image will be hosted.

    VM Mode
  6. On the Virtual machine options page:

    • In the AVAILABILITY SET box, select (None).

    • Read and accept the legal terms.



  7. Click the check mark in the bottom right corner to continue.

  8. Azure creates the virtual machine and configures the operating system settings. After Azure completes provisioning the virtual machine, it is listed as Running in the Azure Management Portal. If it is listed as Stopped, click Restart. During provisioning process, a storage account is created automatically unless you specify your own. When you create a virtual machine, a cloud service is created for you. The cloud service that is created to contain the first virtual machine is not shown in the Management Portal until you connect additional virtual machines to the first machine. Azure defines the name of this new cloud service by using the DNS name entered in the VM Mode page.

    Storage Account

When provisioning the second SQL Server virtual machine, follow the steps described in this section, except:

  1. On the Virtual machine configuration page, type SQLVM2 as a VIRTUAL MACHINE NAME.

  2. On the Virtual machine mode page, select Connect to Existing Virtual Machine and SQLVM1 (sqlvm2012.cloudapp.net). Select the most suitable existing Storage Account or leave the storage account as Use Automatically Generated Storage Account if no suitable storage account exists yet.



Azure creates this second virtual machine and configures the operating system settings. After Azure completes provisioning the second virtual machine, it is listed as Running in the Azure Management Portal. Note that these two virtual machines share the same DNS Name.

When you create the first virtual machine, a cloud service is created for you. But you cannot see it in the Management Portal until you connect additional machines to it. After you connect additional virtual machines to the first machine, the cloud service is automatically shown in the Management Portal. Note that these two virtual machines have the same public IP address.

Open the virtual machines using Remote Desktop and complete setup

  1. In the Azure Portal, click SQLVM1 virtual machine name you created to open its Dashboard.

  2. At the bottom menu, click Connect and log in to the virtual machine using Remote Desktop (RDP). Use the Administrator credentials to log in.

    Remote Desktop Connection in Windows Azure
  3. The first time you log on to this virtual machine, several processes may need to complete, including setup of your desktop, Windows updates, and completion of the Windows initial configuration tasks (sysprep). After Windows sysprep completes, SQL Server setup completes configuration tasks. Once you are connected to the virtual machine with Windows Remote Desktop, the virtual machine works much like any other computer. You can connect to the default instance of SQL Server with SQL Server Management Studio (running on the virtual machine) in the normal way.

  4. Close remote desktop.

To complete the setup for the second virtual machine, simply repeat the steps that are listed in this section for SQLVM2.

Complete configuration steps to connect one SQL Server virtual machine to another SQL Server virtual machine in the same cloud service

  1. Connect to the first virtual machine SQLVM1 via Remote Desktop.

  2. You need to configure SQL Server to listen on the TCP protocol. To do this, click Start | All Programs | Microsoft SQL Server 2012 | Configuration Tools and open SQL Server Configuration Manager.

  3. In SQL Server Configuration Manager, expand SQL Server Network Configuration in the console pane.

  4. Click Protocols for instance name. (The default instance is Protocols for MSSQLSERVER).

  5. In the details pane, right-click TCP, it should be Enabled for the gallery images by default. For your custom images, click Enable (if its status is Disabled.)

  6. In the details pane, right-click SQL Server (instance name) (the default instance is SQL Server (MSSQLSERVER), and then click Restart, to stop and restart the instance of SQL Server.

  7. Then, you need to open TCP ports in the Windows firewall for the default instance of the Database Engine. To do this, click Start | All Programs | Administrative Tools, and open Windows Firewall with Advanced Security.

    Windows Firewall Settings
  8. In the Windows Firewall with Advanced Security, in the left pane, right-click Inbound Rules, and then click New Rule in the action pane.

  9. In the Rule Type dialog box, select Port, and then click Next.

  10. In the Protocol and Ports dialog box, select TCP. Select Specific local ports, and then type the port number of the instance of the Database Engine (1433 for the default instance). Click Next.

  11. In the Action dialog box, select Allow the connection, and then click Next.

  12. In the Profile dialog box, select Domain, Private, Public, and then click Next.

  13. In the Name page, set the Inbound Rule's Name to SQLServerVM1Port and click Finish. Close Windows Firewall with Advanced Security window.

  14. Next, you need to configure SQL Server for mixed mode authentication. The SQL Server Database Engine cannot use Windows Authentication without domain environment. To do this, click All Programs | Microsoft SQL Server 2012, and then click SQL Server Management Studio.

  15. In the Connect to Server dialog box, for the Server name, type the host name of the virtual machine to connect to the Database Engine with the Object Explorer. Select Windows Authentication. Click Connect.

  16. In SQL Server Management Studio Object Explorer, right-click the name of the instance of SQL Server (the virtual machine name), and then click Properties.

    Connect to SQL Server Database
  17. On the Security page, under Server authentication, select SQL Server and Windows Authentication mode, and then click OK.

    Server Properties
  18. In Object Explorer, right-click your server, and then click Restart.

  19. Next, you need to create a SQL Server authentication login to connect to the first virtual machine from another computer. To do this, in SQL Server Management Studio Object Explorer, expand the SQLVM1 server instance in which you want to create the new login. Right-click the Security folder, point to New, and select Login….

  20. In the Login – New dialog box, on the General page, enter the name of the new user sqlvm1login in the Login name box. Select SQL Server authentication. In the Password box, enter a password for the new user. Enter that password again into the Confirm Password box. Leave default values in other boxes.

    Login properties
  21. On the Server Roles page, click sysadmin, if you want to designate this login as a SQL Server administrator. Click OK. By default, Azure selects Windows Authentication during SQL Server Virtual Machine setup. Therefore, the sa login is disabled and a password is assigned by setup. To use the sa login, enable it and also assign a new password. For more information, see Change Server Authentication Mode.

To prepare the second virtual machine, simply repeat the steps that are listed in this section, except:

  1. Connect to the second virtual machine SQLVM2 via Remote Desktop in the Management Portal.

  2. When opening a TCP port for the second virtual machine, set the Inbound Rule's Name to SQLServerVM2Port.

  3. When creating a SQL Server authentication login in SQLVM2, enter sqlvm2login as the name of the new user in the Login name box.

Open a virtual machine and connect to SQL Server in another virtual machine

  1. In the Azure Management Portal, select VIRTUAL MACHINES | SQLVM1. Click Connect button to remote desktop to the first virtual machine. Enter Administrator credentials to connect to the first virtual machine.

  2. In the virtual machine, SQLVM1, open SQL Server Management Studio.

  3. In the Object Explorer, click Connect, choose Database Engine…

  4. In the Connect to Server dialog box, type SQLVM2 as a server name. Select SQL Server Authentication. Type sqlvm2login as a login name and enter the password you specified earlier. Click Connect.

When connecting from SQLVM2 to SQLVM1, simply follow the steps that are listed in this section, except:

  1. In the Azure Management Portal, select VIRTUAL MACHINES | SQLVM2 to connect to.

  2. In the Connect to Server dialog box, type SQLVM1 as a server name and sqlvm1login as a login name.

WarningWarning
When you connect to another virtual machine in the same cloud service, do not use the internal or external IP addresses that are assigned to that virtual machine. The reason is that the IP addresses might change when Azure moves resources for redundancy or maintenance. Note that SQLVM1 and SQLVM2 share the same DNS name, which is sqlvm2012.cloudapp.net.

See Also

Syntes du, dette var nyttigt?
(1500 tegn tilbage)
Tak for din feedback

Fællesskabsindhold

Tilføj
Vis:
© 2014 Microsoft