快速入门:在 Azure 门户中创建 SQL Server 2017 Windows 虚拟机Quickstart: Create a SQL Server 2017 Windows virtual machine in the Azure portal

本快速入门逐步讲解如何在 Azure 门户中创建 SQL Server 虚拟机。This quickstart steps through creating a SQL Server virtual machine in the Azure portal.

Tip

获取 Azure 订阅Get an Azure subscription

如果没有 Azure 订阅,可在开始前创建一个试用帐户If you don't have an Azure subscription, create a trial account before you begin.

选择 SQL Server VM 映像Select a SQL Server VM image

  1. 使用帐户登录到 Azure 门户Sign in to the Azure portal using your account.

  2. 在 Azure 门户中,选择“创建资源” 。In the Azure portal, select Create a resource.

  3. 在搜索框中键入 SQL Server 2017 Developer on Windows Server 2016 并按 ENTER。In the search field, type SQL Server 2017 Developer on Windows Server 2016, and press ENTER.

  4. 选择“免费 SQL Server 许可证: Windows Server 2016 上的 SQL Server 2017 Developer”映像。Select the Free SQL Server License: SQL Server 2017 Developer on Windows Server 2016 image. 本教程中使用 Developer 版,因为该版本是 SQL Server 的完整功能版本,并且可免费用于开发测试。The Developer edition is used in this tutorial because it is a full-featured edition of SQL Server that is free for development testing purposes. 只需支付运行 VM 的成本。You pay only for the cost of running the VM. 有关完整的定价注意事项,请参阅 SQL Server Azure VM 定价指南For complete pricing considerations, see Pricing guidance for SQL Server Azure VMs.

    新搜索窗口

  5. 选择“创建” 。Select Create.

提供基本详细信息Provide basic details

在“基本信息”选项卡中提供以下信息: On the Basics tab, provide the following information:

  1. 在“名称”字段中,输入唯一的虚拟机名称。 In the Name field, enter a unique virtual machine name.

  2. 在“用户名”字段中,指定 VM 上本地管理员帐户的名称。 In the User name field, enter a name for the local administrator account on the VM.

  3. 提供一个强 密码Provide a strong Password.

  4. 输入新的资源组名称。Enter a new Resource group name. 可借助此组管理与虚拟机关联的所有资源。This group helps to manage all resources associated with the virtual machine.

  5. 确认其他默认设置,然后单击“确定”继续。 Verify the other default settings, and click OK to continue.

    SQL 基本信息窗口

选择虚拟机大小Choose virtual machine size

  1. 执行“大小”设置步骤时,请在“选择大小”窗口中选择虚拟机大小。 On the Size step, choose a virtual machine size in the Choose a size window.

    对于本快速入门,请选择“D2S_V3”。 For this quickstart, select D2S_V3. 门户中会显示计算机的每月连续使用估算费用(不包括 SQL Server 许可费用)。The portal shows the estimated monthly machine cost for continuous use (not including SQL Server licensing costs). 请注意,Developer Edition 不会收取额外的 SQL Server 许可费用。Note that the Developer Edition has no extra licensing costs for SQL Server. 有关更具体的定价信息,请参阅定价页For more specific pricing information, see the pricing page.

    Tip

    在测试时,D2S_V3 计算机大小可以节省资金。 但是,对于生产工作负荷,请参阅 Azure 虚拟机中 SQL Server 的性能最佳做法中建议的计算机大小和配置。

  2. 单击“选择”继续。 Click Select to continue.

配置可选功能Configure optional features

  1. 如果想要通过远程桌面连接到 VM,请在“设置” 窗口中,从“选择公共入站端口” 列表中选择“RDP (3389)” 端口。In the Settings window, select the RDP (3389) port in the Select public inbound ports list if you want to remote desktop into the VM.

    入站端口

    Note

    可以选择“MS SQL (1433)” 端口以远程访问 SQL Server。 但是,这不必要,因为 SQL Server 设置步骤也提供此选项。 如果在此步骤中选择了端口 1433,则无论在 SQL Server 设置步骤中选择了哪一项,都会打开该端口。

  2. 单击“确定” 保存所做的更改并继续。Click OK to save your changes and continue.

SQL Server 设置SQL Server settings

在“SQL Server 设置”窗口中配置以下选项。 On the SQL Server settings window, configure the following options.

  1. 在“SQL 连接”下拉列表中,选择“公共(Internet)”。 In the SQL connectivity drop-down, select Public (Internet). 这样,便可以通过 Internet 建立 SQL Server 连接。This allows SQL Server connections over the internet.

  2. 将“端口”更改为 1401,以避免在公共方案中使用已知的端口名称。 Change the Port to 1401 to avoid using a well-known port name in the public scenario.

  3. 在“SQL 身份验证”下面,单击“启用”。 Under SQL Authentication, click Enable. SQL 登录名设置为针对 VM 配置的相同用户名和密码。The SQL Login is set to the same user name and password that you configured for the VM.

  4. 根据需要更改其他任何设置,然后单击“确定”完成 SQL Server VM 的配置。 Change any other settings if needed, and click OK to complete the configuration of the SQL Server VM.

    SQL Server 设置

创建 SQL Server VMCreate the SQL Server VM

在“摘要”窗口上查看摘要,并单击“确定”以创建为此 VM 指定的 SQL Server、资源组和资源。 On the Summary window, review the summary and click OK to create SQL Server, resource group, and resources specified for this VM.

可以从 Azure 门户监视部署情况。You can monitor the deployment from the Azure portal. 屏幕顶部的“通知” 按钮显示部署的基本状态。The Notifications button at the top of the screen shows basic status of the deployment.

Tip

部署 Windows SQL Server VM 可能需要几分钟时间。

连接到 SQL ServerConnect to SQL Server

  1. 在门户上虚拟机属性的“概述”部分,找到 SQL Server VM 的“公共 IP 地址”。 In the portal, find the Public IP address of your SQL Server VM in the Overview section of your virtual machine's properties.

  2. 在连接到 Internet 的其他计算机上,打开 SQL Server Management Studio (SSMS)On a different computer connected to the Internet, open SQL Server Management Studio (SSMS).

  3. 在“连接到服务器”或“连接到数据库引擎”对话框中,编辑“服务器名称”值 。In the Connect to Server or Connect to Database Engine dialog box, edit the Server name value. 输入 VM 的公共 IP 地址。Enter your VM's public IP address. 添加一个逗号,然后添加配置新 VM 时指定的自定义端口 1401Then add a comma, and add the custom port, 1401, that we specified when you configured the new VM. 例如,11.22.33.444,1401For example, 11.22.33.444,1401.

  4. 在“身份验证”框中,选择“SQL Server 身份验证” 。In the Authentication box, select SQL Server Authentication.

  5. 在“登录” 框中,键入有效 SQL 登录的名称。In the Login box, type the name of a valid SQL login.

  6. 在“密码” 框中,键入登录的密码。In the Password box, type the password of the login.

  7. 选择“连接” 。Select Connect.

    ssms 连接

远程登录到 VMLog in to the VM remotely

使用以下步骤通过远程桌面连接到 SQL Server 虚拟机:Use the following steps to connect to the SQL Server virtual machine with Remote Desktop:

  1. 创建并运行 Azure 虚拟机以后,单击 Azure 门户中的“虚拟机”图标即可查看 VM。After the Azure virtual machine is created and running, click the Virtual Machines icon in the Azure portal to view your VMs.

  2. 单击对应于新建 VM 的省略号 ...。Click the ellipsis, ..., for your new VM.

  3. 单击“连接”。Click Connect.

    在门户中连接到 VM

  4. 打开浏览器为 VM 下载的 RDP 文件。Open the RDP file that your browser downloads for the VM.

  5. “远程桌面连接”会通知你,无法识别此远程连接的发布者。The Remote Desktop Connection notifies you that the publisher of this remote connection cannot be identified. 单击“ 连接 ”以继续。Click Connect to continue.

  6. 在“Windows 安全性”对话框中,单击“使用其他帐户”。In the Windows Security dialog, click Use a different account. 可能需要单击“更多选项”才能看到此项。You might have to click More choices to see this. 指定在创建 VM 时配置的用户名和密码。Specify the user name and password that you configured when you created the VM. 必须在用户名之前添加反斜杠。You must add a backslash before the user name.

    远程桌面身份验证

  7. 单击“确定”进行连接。Click OK to connect.

连接到 SQL Server 虚拟机以后,即可启动 SQL Server Management Studio 并使用本地管理员凭据通过 Windows 身份验证进行连接。After you connect to the SQL Server virtual machine, you can launch SQL Server Management Studio and connect with Windows Authentication using your local administrator credentials. 如果已启用 SQL Server 身份验证,也可以使用在预配期间配置的 SQL 登录名和密码来配合 SQL 身份验证进行连接。If you enabled SQL Server Authentication, you can also connect with SQL Authentication using the SQL login and password you configured during provisioning.

通过访问计算机,可以根据要求直接更改计算机和 SQL Server 设置。Access to the machine enables you to directly change machine and SQL Server settings based on your requirements. 例如,可以配置防火墙设置或更改 SQL Server 配置设置。For example, you could configure the firewall settings or change SQL Server configuration settings.

清理资源Clean up resources

如果不需要让 SQL VM 持续运行,可以在不使用它时将它停止,以免产生不必要的费用。If you do not need your SQL VM to run continually, you can avoid unnecessary charges by stopping it when not in use. 也可以永久删除与该虚拟机关联的所有资源,在门户中删除其关联的资源组即可。You can also permanently delete all resources associated with the virtual machine by deleting its associated resource group in the portal. 请小心使用此命令,因为它也会永久删除该虚拟机。This permanently deletes the virtual machine as well, so use this command with care. 有关详细信息,请参阅通过门户管理 Azure 资源For more information, see Manage Azure resources through portal.

后续步骤Next steps

在本快速入门中,你在 Azure 门户中创建了一个 SQL Server 2017 虚拟机。In this quickstart, you created a SQL Server 2017 virtual machine in the Azure portal. 若要详细了解如何将数据迁移到新的 SQL Server,请参阅以下文章。To learn more about how to migrate your data to the new SQL Server, see the following article.