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

通过 Azure 门户在 Azure Stack Edge Pro GPU 设备上部署 VMDeploy VMs on your Azure Stack Edge Pro GPU device via the Azure portal

适用于对于 Pro GPU SKU 是必需的Azure Stack Edge Pro - GPU对于 Pro R SKU 是必需的Azure Stack Edge Pro R对于 Mini R SKU 是必需的Azure Stack Edge Mini R               APPLIES TO: Yes for Pro GPU SKUAzure Stack Edge Pro - GPUYes for Pro R SKUAzure Stack Edge Pro RYes for Mini R SKUAzure Stack Edge Mini R                  

你可以使用 Azure 门户、模板、Azure PowerShell cmdlet 以及通过 Azure CLI/Python 脚本在 Azure Stack Edge 设备上创建和管理虚拟机 (VM)。You can create and manage virtual machines (VMs) on an Azure Stack Edge device using Azure portal, templates, Azure PowerShell cmdlets and via Azure CLI/Python scripts. 本文介绍如何使用 Azure 门户在 Azure Stack Edge 设备上创建和管理 VM。This article describes how to create and manage a VM on your Azure Stack Edge device using the Azure portal.

本文适用于 Azure Stack Edge Pro GPU、Azure Stack Edge Pro R 和 Azure Stack Edge Mini R 设备。This article applies to Azure Stack Edge Pro GPU, Azure Stack Edge Pro R, and Azure Stack Edge Mini R devices.

重要

我们建议你为管理云设备上部署的 VM 的用户启用多重身份验证。We recommend that you enable multifactor authentication for the user who manages VMs that are deployed on your device from the cloud.

VM 部署工作流VM deployment workflow

下面是此部署工作流的基本摘要信息:The high-level summary of the deployment workflow is as follows:

  1. 在 Azure Stack Edge 设备上启用计算网络接口。Enable a network interface for compute on your Azure Stack Edge device. 这会在指定的网络接口上创建一个虚拟交换机。This creates a virtual switch on the specified network interface.

  2. 通过 Azure 门户启用虚拟机云管理。Enable cloud management of virtual machines from Azure portal.

  3. 使用存储资源管理器将 VHD 上传到 Azure 存储帐户。Upload a VHD to an Azure Storage account using Storage Explorer.

  4. 使用上传的 VHD 将 VHD 下载到设备上,并从 VHD 创建 VM 映像。Use the uploaded VHD to download the VHD onto the device and create a VM image from the VHD.

  5. 使用在前面的步骤中创建的服务:Use the resources created in the previous steps:

    1. 所创建的 VM 映像。VM image that you created.
    2. 与启用了计算的网络接口关联的 VSwitch。VSwitch associated with the network interface on which you enabled compute.
    3. 与 VSwitch 关联的子网。Subnet associated with the VSwitch.

    并创建或指定以下内联资源:And create or specify the following resources inline:

    1. VM 名称,为 VM 选择支持的 VM 大小和登录凭据。VM name, choose a supported VM size, sign-in credentials for the VM.
    2. 创建新的数据磁盘或附加现有的数据磁盘。Create new data disks or attach existing data disks.
    3. 为 VM 配置静态或动态 IP。Configure static or dynamic IP for the VM. 如果提供静态 IP,请在为计算启用的网络接口的子网范围中选择一个可用 IP。If providing a static IP, choose from a free IP in the subnet range of the network interface enabled for compute.

    使用上述资源创建虚拟机。Use the resources from above to create a virtual machine.

先决条件Prerequisites

在开始通过 Azure 门户在设备上创建和管理 VM 之前,请确保:Before you begin to create and manage VMs on your device via the Azure portal, make sure that:

  1. 已完成 Azure Stack Edge Pro 设备上的网络设置,如步骤 1:配置 Azure Stack Edge Pro 设备中所述。You have completed the network settings on your Azure Stack Edge Pro device as described in Step 1: Configure Azure Stack Edge Pro device.

    1. 已启用计算网络接口。You have enabled a network interface for compute. 此网络接口 IP 用于为 VM 部署创建虚拟交换机。This network interface IP is used to create a virtual switch for the VM deployment. 在设备的本地 UI 中,转到“计算”。In the local UI of your device, go to Compute. 选择将用于创建虚拟交换机的网络接口。Select the network interface that you will use to create a virtual switch.

      重要

      只能为计算配置一个端口。You can only configure one port for compute.

    2. 在网络接口上启用计算。Enable compute on the network interface. Azure Stack Edge Pro 创建并管理与该网络接口相对应的虚拟交换机。Azure Stack Edge Pro creates and manages a virtual switch corresponding to that network interface.

  2. 你有权访问将用于为要创建的虚拟机创建 VM 映像的 Windows 或 Linux VHD。You have access to a Windows or Linux VHD that you will use to create the VM image for the virtual machine you intend to create.

部署 VMDeploy a VM

按照以下步骤在 Azure Stack Edge 设备上创建虚拟机。Follow these steps to create a virtual machine on your Azure Stack Edge device.

添加 VM 映像Add a VM image

  1. 将 VHD 上传到 Azure 存储帐户。Upload a VHD to an Azure Storage account. 按照使用 Azure 存储资源管理器上传 VHD 中的步骤操作。Follow the steps in Upload a VHD using Azure Storage Explorer.

  2. 在 Azure 门户中,转到 Azure Stack Edge 设备的 Azure Stack Edge 资源。In the Azure portal, go to the Azure Stack Edge resource for your Azure Stack Edge device. 转到“Edge 计算”>“虚拟机”。Go to Edge compute > Virtual Machines.

    添加 VM 映像 1

  3. 选择“虚拟机”,转到“概述”页 。Select Virtual Machines to go to the Overview page. “启用”虚拟机云管理。Enable virtual machine cloud management. 添加 VM 映像 2Add VM image 2

  4. 第一步是添加 VM 映像。The first step is to add a VM image. 在之前的步骤中,你已将 VHD 上传到存储帐户。You have already uploaded a VHD into the storage account in the earlier step. 你将使用此 VHD 来创建 VM 映像。You will use this VHD to create a VM image.

    选择“添加映像”,从存储帐户下载 VHD,并将其添加到设备中。Select Add image to download the VHD from the storage account and add to the device. 下载过程需要几分钟时间,具体取决于 VHD 的大小和用于下载的 Internet 带宽。The download process takes several minutes depending upon the size of the VHD and the internet bandwidth available for the download.

    添加 VM 映像 3

  5. 在“添加映像”边栏选项卡中,输入以下参数。In the Add image blade, input the following parameters. 选择 添加Select Add.

    参数Parameter 说明Description
    从存储 blob 下载Download from storage blob 浏览到你上传 VHD 的存储账户中存储 blob 的位置。Browse to the location of the storage blob in the storage account where you uploaded the VHD.
    下载到Download to 自动设置为要在其中部署虚拟机的当前设备。Automatically set to the current device where you are deploying the virtual machine.
    将映像另存为Save image as 要从上传到存储帐户的 VHD 创建的 VM 映像的名称。The name for the VM image that you are creating from the VHD you uploaded to the storage account.
    OS 类型OS type 选择 Windows 或 Linux 作为要用于创建 VM 映像的 VHD 的操作系统。Choose from Windows or Linux as the operating system of the VHD you will use to create the VM image.

    添加 VM 映像 4

  6. 随即将下载 VHD 并创建 VM 映像。The VHD is downloaded and the VM image is created. 映像创建过程需要几分钟时间才能完成。The image creation takes several minutes to complete. 你会看到成功完成 VM 映像的通知。You see a notification for the successful completion of the VM image.

    添加 VM 映像 5

  7. 成功创建 VM 映像后,系统会将其添加到“映像”边栏选项卡中的映像列表。After the VM image is successfully created, it is added to the list of images in the Images blade. 添加 VM 映像 6Add VM image 6

    “部署”边栏选项卡将更新,以指示部署的状态。The Deployments blade updates to indicate the status of the deployment.

    添加 VM 映像 7

    新添加的映像也将显示在“概述”页中。The newly added image is also displayed in the Overview page. 添加 VM 映像 8Add VM image 8

添加 VMAdd a VM

创建 VM 映像后,请按照以下步骤创建 VM。Follow these steps to create a VM after you have created a VM image.

  1. 在“概述”页中,选择“添加虚拟机” 。In the Overview page, select Add virtual machine.

    添加 VM 1

  2. 在“基本信息”选项卡中,输入以下参数。In the Basics tab, input the following parameters.

    参数Parameter 说明Description
    虚拟机名称Virtual machine name
    Edge 资源组Edge resource group 为与 VM 关联的所有资源创建新的资源组。Create a new resource group for all the resources associated with the VM.
    映像Image 从设备上提供的 VM 映像中进行选择。Select from the VM images available on the device.
    大小Size 支持的 VM 大小中进行选择。Choose from the Supported VM sizes.
    用户名Username 使用管理员的默认用户名“azureuser”登录到 VM。Use the default username azureuser for the admin to sign into the VM.
    身份验证类型Authentication type 从 SSH 公钥或用户定义的密码中进行选择。Choose from SSH public key or a user-defined password.
    PasswordPassword 输入用于登录到虚拟机的密码。Enter a password to sign into the virtual machine. 密码必须至少 12 个字符,且符合定义的复杂性要求The password must be at least 12 characters long and meet the defined Complexity requirements.
    确认密码Confirm password 再次输入密码。Enter the password again.

    添加 VM 2

    在完成时选择“下一步:磁盘”Select Next: Disks.

  3. 在“磁盘”选项卡上,将磁盘附加到 VM。In the Disks tab, you will attach disks to your VM.

    1. 你可以选择“创建并附加新磁盘”或“附加现有磁盘” 。You can choose to Create and attach a new disk or Attach an existing disk.

      添加 VM 3

    2. 选择“创建并附加新磁盘”。Select Create and attach a new disk. 在“创建新磁盘”边栏选项卡中,提供磁盘名称和大小 (GiB)。In the Create new disk blade, provide a name for the disk and the size in GiB.

      添加 VM 4

    3. 重复上述步骤,添加更多磁盘。Repeat the above to process to add more disks. 创建磁盘后,这些磁盘会显示在“磁盘”选项卡中。请选择“下一步: 网络”。After the disks are created, they show up in the Disks tab. Select Next: Networking.

  4. 在“网络”选项卡中,你将为 VM 配置网络连接。In the Networking tab, you will configure the network connectivity for your VM.

    参数Parameter 说明Description
    虚拟网络Virtual network 如果在网络接口上启用了计算,请从下拉列表中选择在 Azure Stack Edge 设备上创建的虚拟交换机。From the dropdown list, select the virtual switch created on your Azure Stack Edge device when you enabled compute on the network interface.
    子网Subnet 此字段将自动填充与启用了计算的网络接口关联的子网。This field is automatically populated with the subnet associated with the network interface on which you enabled compute.
    IP 地址IP address 为 VM 提供静态或动态 IP。Provide a static or a dynamic IP for your VM. 静态 IP 应该是指定子网范围内可用的空闲 IP。The static IP should be an available, free IP from the specified subnet range.

    添加 VM 6

    在完成时选择“下一步:查看 + 创建”。Select Next: Review + Create.

  5. 在“高级”选项卡中,可以指定自定义数据或 cloud-init 来自定义你的 VM。In the Advanced tab, you can specify the custom data or the cloud-init to customize your VM.

    在 VM 首次启动时,可以使用 cloud-init 自定义 VM。You can use cloud-init to customize a VM on its first boot. 使用 cloud-init 来安装包和写入文件,或者配置用户和安全性。Use the cloud-init to install packages and write files, or to configure users and security. 当 cloud-init 在初始启动过程中运行时,无需额外的步骤即可应用配置。As cloud-init runs during the initial boot process, no additional steps are requires to apply your configuration. 有关 cloud-init 的详细信息,请参阅 cloud-init 概述For detailed information on cloud-init, see Cloud-init overview.

    添加 VM 7

  6. 在“查看 + 创建”选项卡中,查看 VM 的规范,然后选择“创建” 。In the Review + Create tab, review the specifications for the VM and select Create.

    添加 VM 8

  7. 随即开始创建 VM,此过程可能最多需要 20 分钟。The VM creation starts and can take up to 20 minutes. 你可以转到“部署”来监视 VM 的创建过程。You can go to Deployments to monitor the VM creation.

    添加 VM 9

  8. 成功创建 VM 后,“概述”页将更新,以显示新的 VM。After the VM is successfully created, the Overview page updates to display the new VM.

    添加 VM 10

  9. 选择新创建的 VM,以转到“虚拟机”。Select the newly created VM to go to Virtual machines.

    添加 VM 11

    选择 VM,查看详细信息。Select the VM to see the details.

    添加 VM 12

连接到 VMConnect to a VM

根据所创建的是 Windows 还是 Linux VM,连接步骤可能会有所不同。Depending on whether you created a Windows or a Linux VM, the steps to connect can be different. 通过 Azure 门户无法连接到设备上部署的 VM。You can't connect to the VMs deployed on your device via the Azure portal. 需要执行以下步骤才可连接到 Linux 或 Windows VM。You need to take the following steps to connect to your Linux or Windows VM.

连接到 Linux VMConnect to Linux VM

按照以下步骤连接到 Linux VM。Follow these steps to connect to a Linux VM.

使用 VM 创建期间传递的专用 IP 连接到 VM。Connect to the VM by using the private IP that you passed during the VM creation.

  1. 打开 SSH 会话以连接 IP 地址。Open an SSH session to connect with the IP address.

    ssh -l <username> <ip address>

  2. 在提示符下,提供创建 VM 时使用的密码。At the prompt, provide the password that you used when you created the VM.

    如果需要提供 SSH 密钥,请使用此命令。If you need to provide the SSH key, use this command.

    ssh -i c:/users/Administrator/.ssh/id_rsa Administrator@5.5.41.236

    下面是连接到 VM 时的示例输出:Here's an example output when you connect to the VM:

    PS C:\07-30-2020\linux> ssh -l Administrator 10.126.68.186
    Administrator@10.126.68.186's password:
    Welcome to Ubuntu 18.04.3 LTS (GNU/Linux 5.0.0-1027-azure x86_64)
    
     * Documentation:  https://help.ubuntu.com
     * Management:     https://landscape.canonical.com
     * Support:        https://ubuntu.com/advantage
    
      System information as of Thu Jul 30 22:56:11 UTC 2020
    
      System load:  0.0               Processes:           105
      Usage of /:   5.6% of 28.90GB   Users logged in:     0
      Memory usage: 12%               IP address for eth0: 10.126.68.186
      Swap usage:   0%
    
     * Are you ready for Kubernetes 1.19? It's nearly here! Try RC3 with
       sudo snap install microk8s --channel=1.19/candidate --classic
    
       https://www.microk8s.io/ has docs and details.
    
    68 packages can be updated.
    0 updates are security updates.
    
    
    *** System restart required ***
    
    The programs included with the Ubuntu system are free software;
    the exact distribution terms for each program are described in the
    individual files in /usr/share/doc/*/copyright.
    
    Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
    applicable law.
    
    To run a command as administrator (user "root"), use "sudo <command>".
    See "man sudo_root" for details.
    
    Administrator@mylinuxvm:
    
  3. 如果在创建 VM 的过程中使用了公共 IP 地址,则可以使用该 IP 来连接到 VM。If you used a public IP address during the VM creation, you can use that IP to connect to the VM. 若要获取公共 IP,请运行以下命令:To get the public IP, run the following command:

    $publicIp = Get-AzureRmPublicIpAddress -Name <Public IP> -ResourceGroupName <Resource group name>
    

    在此实例中,公共 IP 与创建虚拟网络接口期间传递的专用 IP 相同。In this instance, the public IP is the same as the private IP that you passed during the creation of the virtual network interface.

连接到 Windows VMConnect to Windows VM

按照以下步骤连接到 Windows VM。Follow these steps to connect to a Windows VM.

使用远程桌面协议 (RDP) 通过在 VM 创建期间传递的 IP 来连接到 Windows VM。Connect to your Windows VM by using the Remote Desktop Protocol (RDP) via the IP that you passed during the VM creation.

  1. 在客户端上,打开 RDP。On your client, open RDP.

  2. 中转到 " 开始",然后键入 mstscGo to Start, and then type mstsc.

  3. 在 " 远程桌面连接 " 窗格上,输入 VM 的 IP 地址以及在 vm 模板参数文件中使用的访问凭据,然后选择 " 连接"。On the Remote Desktop Connection pane, enter the IP address of the VM and the access credentials you used in the VM template parameters file, and then select Connect.

    用于通过 RDP 连接到 Windows VM 的 "远程桌面连接" 窗格的屏幕截图。

    备注

    你可能需要批准连接到不受信任的计算机。You might need to approve connecting to an untrusted machine.

你现在已登录到设备上运行的 VM。You’re now signed in to your VM that runs on the appliance.

后续步骤Next steps

若要了解如何管理 Azure Stack Edge Pro 设备,请参阅使用本地 WEB UI 管理 Azure Stack Edge ProTo learn how to administer your Azure Stack Edge Pro device, seeUse local web UI to administer a Azure Stack Edge Pro.