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

可以通过 Azure 门户创建 Azure 虚拟机 (VM)。Azure virtual machines (VMs) can be created through the Azure portal. 此方法提供基于浏览器的用户界面来创建 VM 及其相关资源。This method provides a browser-based user interface to create VMs and their associated resources. 本快速入门展示了如何使用 Azure 门户在 Azure 中部署运行 Windows Server 2019 的虚拟机 (VM)。This quickstart shows you how to use the Azure portal to deploy a virtual machine (VM) in Azure that runs Windows Server 2019. 若要查看运行中的 VM,可以通过 RDP 登录到该 VM 并安装 IIS Web 服务器。To see your VM in action, you then RDP to the VM and install the IIS web server.

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

登录 AzureSign in to Azure

通过 https://portal.azure.cn 登录到 Azure 门户。Sign in to the Azure portal at https://portal.azure.cn.

创建虚拟机Create virtual machine

  1. 在 Azure 门户的左上角选择“创建资源”。Choose Create a resource in the upper left-hand corner of the Azure portal.

  2. 在“新建”页上的搜索栏中,输入 Windows Server 2019 Datacenter,然后按 Enter 。In the New page, enter Windows Server 2019 Datacenter in the Search bar, then select the Enter key.

  3. 在“搜索结果”页中选择 Windows Server 2019 Datacenter 项,然后选择“创建” 。Select the Windows Server 2019 Datacenter items in search result page, then select the Create.

  4. 在“基本信息”标签页中的“项目详细信息”下,确保选择了正确的订阅,然后选择“新建资源组”。In the Basics tab, under Project details, make sure the correct subscription is selected and then choose to Create new resource group. 对于名称,请键入 myResourceGroupType myResourceGroup for the name.


    通过 Azure 门户、PowerShell 或 CLI 创建任何 Azure 资源时,除了原始资源命名约定之外,我们还应遵循以下限制。When you create any Azure resource through the Azure Portal, PowerShell, or CLI, we should follow the below restriction in additional except for the original resource naming conventions.

    指定的所有参数中的任何字符都应设置为英文字符。Any character in all parameters you specified should be included in the English characters set.

    如果参数中有任何非英语字符(如中文字符),相应的调用可能会出现错误。When there are any None English characters in parameter, such as Chinese characters, the corresponding invoke may be run into error.

    “项目详细信息”部分的屏幕截图,显示为虚拟机选择 Azure 订阅和资源组的位置

  5. 在“实例详细信息”下,对于“虚拟机名称”键入“myVM”,对于“区域”选择“中国东部”。Under Instance details, type myVM for the Virtual machine name and choose China East for your Region. 保留其他默认值。Leave the other defaults.


  6. 在“管理员帐户”下,提供用户名(例如 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.


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


  8. 保留其余默认值,然后选择页面底部的“查看 + 创建”按钮。Leave the remaining defaults and then select the Review + create button at the bottom of the page.


连接到虚拟机Connect to virtual machine

创建与虚拟机的远程桌面连接。Create a remote desktop connection to the virtual machine. 这些说明指明了如何从 Windows 计算机连接到 VM。These directions tell you how to connect to your VM from a Windows computer. 在 Mac 上,需要一个 RDP 客户端,例如 Mac 应用商店提供的这个远程桌面客户端On a Mac, you need an RDP client such as this Remote Desktop Client from the Mac App Store.

  1. 选择虚拟机概述页上的“连接”按钮。Select the Connect button on the overview page for your virtual machine.


  2. 在“连接到虚拟机”页面中,保留默认选项,以使用 IP 地址通过端口 3389 进行连接,然后单击“下载 RDP 文件” 。In the Connect to virtual machine page, keep the default options to connect by IP address, over port 3389, and click Download RDP file.

  3. 打开下载的 RDP 文件,然后在出现提示时单击“连接”。Open the downloaded RDP file and click Connect when prompted.

  4. 在“Windows 安全性”窗口中,依次选择“更多选择”、“使用其他帐户”。In the Windows Security window, select More choices and then Use a different account. localhost\username 的形式键入用户名,输入为虚拟机创建的密码,然后单击“确定”。Type the username as localhost\username, enter password you created for the virtual machine, and then click OK.

  5. 你可能会在登录过程中收到证书警告。You may receive a certificate warning during the sign-in process. 单击“是”或“继续”以创建连接。 Click Yes or Continue to create the connection.

安装 Web 服务器Install web server

若要查看运行中的 VM,请安装 IIS Web 服务器。To see your VM in action, install the IIS web server. 在 VM 中打开 PowerShell 提示符并运行以下命令:Open a PowerShell prompt on the VM and run the following command:

Install-WindowsFeature -name Web-Server -IncludeManagementTools

完成后,关闭到 VM 的 RDP 连接。When done, close the RDP connection to the VM.

查看 IIS 欢迎页View the IIS welcome page

在门户中选择 VM,在 VM 的概述中,使用 IP 地址右侧的“单击以复制”按钮复制该地址,并将其粘贴到浏览器选项卡中。此时会打开默认的 IIS 欢迎页,如下所示:In the portal, select the VM and in the overview of the VM, use the Click to copy button to the right of the IP address to copy it and paste it into a browser tab. The default IIS welcome page will open, and should look like this:

浏览器中的 IIS 默认站点的屏幕截图

清理资源Clean up resources

当不再需要时,可以删除资源组、虚拟机和所有相关资源。When no longer needed, you can delete the resource group, virtual machine, and all related resources.

选择虚拟机的资源组,然后选择“删除” 。Select the resource group for the virtual machine, then select Delete. 确认资源组名称,以完成资源删除。Confirm the name of the resource group to finish deleting the resources.

后续步骤Next steps

在本快速入门中,你部署了简单的虚拟机,打开了 Web 流量的网络端口,并安装了一个基本 Web 服务器。In this quickstart, you deployed a simple virtual machine, open a network port for web traffic, and installed a basic web server. 若要深入了解 Azure 虚拟机,请继续学习 Windows VM 教程。To learn more about Azure virtual machines, continue to the tutorial for Windows VMs.