您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

快速入门:在 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.

提示

获取 Azure 订阅Get an Azure subscription

如果没有 Azure 订阅,请在开始之前创建一个免费帐户If you don't have an Azure subscription, create a free 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 门户的左侧菜单中选择“Azure SQL” 。Select Azure SQL in the left-hand menu of the Azure portal. 如果 Azure SQL 不在列表中,请选择“所有服务” ,然后在搜索框中键入“Azure SQL” 。If Azure SQL is not in the list, select All services, then type Azure SQL in the search box.

  3. 选择“+添加” 以打开“选择 SQL 部署选项” 页。Select +Add to open the Select SQL deployment option page. 可以通过在“SQL 虚拟机” 磁贴上选择“显示详细信息” 来查看其他信息。You can view additional information by selecting Show details on the SQL virtual machines tile.

  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 from the dropdown.

    新搜索窗口

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

    新搜索窗口

提供基本详细信息Provide basic details

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

  1. 在“项目详细信息”部分选择你的 Azure 订阅,然后选择“新建”以创建新的资源组。 In the Project Details section, select your Azure subscription and then select Create new to create a new resource group. 键入 SQLVM-RG 作为名称。Type SQLVM-RG for the name.

    Subscription

  2. 在“实例详细信息”下: Under Instance details:

    1. 键入 SQLVM 作为虚拟机名称Type SQLVM for the Virtual machine name.
    2. 为“区域”选择一个位置。 Choose a location for your Region.
    3. 本快速入门将“可用性选项”保留设置为“无需基础结构冗余”。 For the purpose of this quickstart, leave Availability options set to No infrastructure redundancy required. 有关可用性选项的详细信息,请参阅可用性To find out more information about availability options, see Availability.
    4. 在“映像”列表中,选择“免费 SQL Server 许可证: Windows Server 2016 上的 SQL Server 2017 Developer”的映像。In the Image list, select Free SQL Server License: SQL Server 2017 Developer on Windows Server 2016.
    5. 对于虚拟机大小,请选择“更改大小”,然后选择“A2 基本”产品/服务。 Choose to Change size for the Size of the virtual machine and select the A2 Basic offering. 用完资源后,请务必清理资源,以免产生任何意外的费用。Be sure to clean up your resources once you're done with them to prevent any unexpected charges.

    实例详细信息

  3. 在“管理员帐户”下提供用户名(例如 azureuser)和密码。 Under Administrator account, provide a username, such as azureuser and a password. 密码必须至少 12 个字符长,且符合定义的复杂性要求The password must be at least 12 characters long and meet the defined complexity requirements.

    管理员帐户

  4. 在“入站端口规则”下,选择“允许所选端口”,然后从下拉列表中选择“RDP (3389)”。 Under Inbound port rules, choose Allow selected ports and then select RDP (3389) from the drop-down.

    入站端口规则

SQL Server 设置SQL Server settings

在“SQL Server 设置”选项卡中配置以下选项: On the SQL Server settings tab, configure the following options:

  1. 在“安全性和网络”下,为“SQL 连接”选择“公共(Internet)”,并将端口更改为 1401,以避免在公共方案中使用众所周知的端口号。 Under Security & Networking, select Public (Internet) for SQL Connectivity and change the port to 1401 to avoid using a well-known port number in the public scenario.

  2. 在“SQL 身份验证”下,选择“启用”。 Under SQL Authentication, select Enable. SQL 登录名设置为针对 VM 配置的相同用户名和密码。The SQL Login is set to the same user name and password that you configured for the VM. 使用 Azure Key Vault 集成的默认设置。Use the default setting for Azure Key Vault integration. 存储配置不可用于基本 SQL Server VM 映像,但你可以在存储配置中找到有关其他映像的可用选项的详细信息。Storage configuration is not available for the basic SQL Server VM image but you can find more information about available options for other images at storage configuration.

    SQL Server 安全性设置

  3. 根据需要更改其他任何设置,然后选择“查看 + 创建”。 Change any other settings if needed, and then select Review + create.

    查看 + 创建

创建 SQL Server VMCreate the SQL Server VM

在“查看 + 创建”选项卡中查看摘要,然后选择“创建”以创建为此 VM 指定的 SQL Server、资源组和资源。 On the Review + create tab, review the summary, and select Create 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. 部署可能需要几分钟的时间。Deployment can take several minutes.

连接到 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.