您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.
快速入门:使用 ARM 模板创建 Ubuntu Linux 虚拟机Quickstart: Create an Ubuntu Linux virtual machine using an ARM template
06/04/2020
本文内容
本快速入门介绍如何使用 Azure 资源管理器模板(ARM 模板)在 Azure 中部署 Ubuntu Linux 虚拟机 (VM)。This quickstart shows you how to use an Azure Resource Manager template (ARM template) to deploy an Ubuntu Linux virtual machine (VM) in Azure.
ARM 模板是定义项目基础结构和配置的 JavaScript 对象表示法 (JSON) 文件。An ARM template is a JavaScript Object Notation (JSON) file that defines the infrastructure and configuration for your project. 模板使用声明性语法。The template uses declarative syntax. 在声明性语法中,你可以在不编写创建部署的编程命令序列的情况下,描述预期部署。In declarative syntax, you describe your intended deployment without writing the sequence of programming commands to create the deployment.
如果你的环境满足先决条件,并且你熟悉如何使用 ARM 模板,请选择“部署到 Azure”按钮。If your environment meets the prerequisites and you're familiar with using ARM templates, select the Deploy to Azure button. Azure 门户中会打开模板。The template will open in the Azure portal.
先决条件Prerequisites
如果没有 Azure 订阅,请在开始之前创建一个免费帐户。If you don't have an Azure subscription, create a free account before you begin.
查看模板Review the template
本快速入门中使用的模板来自 Azure 快速启动模板。The template used in this quickstart is from Azure Quickstart Templates.
该模板中定义了多个资源:Several resources are defined in the template:
部署模板Deploy the template
选择下图登录到 Azure 并打开一个模板。Select the following image to sign in to Azure and open a template. 该模板将创建 Key Vault 和机密。The template creates a key vault and a secret.
选择或输入以下值。Select or enter the following values. 使用可用的默认值。Use the default values, when available.
订阅:选择一个 Azure 订阅。Subscription: select an Azure subscription.
资源组:从下拉列表中选择现有资源组,或选择“新建”并输入资源组的唯一名称,然后单击“确定” 。Resource group: select an existing resource group from the drop-down, or select Create new, enter a unique name for the resource group, and then click OK.
位置:选择一个位置。Location: select a location. 例如“美国中部”。For example, Central US.
管理员用户名:提供用户名,如 azureuser。Admin username: provide a username, such as azureuser.
身份验证类型:可以在使用 SSH 密钥或密码之间进行选择。Authentication type: You can choose between using an SSH key or a password.
管理员密码或密钥,具体取决于你选择了哪种身份验证类型:Admin Password Or Key depending on what you choose for authentication type:
如果选择“密码”,则密码长度必须至少为 12 个字符,且符合定义的复杂性要求。If you choose password, the password must be at least 12 characters long and meet the defined complexity requirements.
如果选择“sshPublicKey”,则粘贴公钥的内容。If you choose sshPublicKey, paste in the contents of your public key.
DNS 标签前缀:输入要用作 DNS 标签一部分的唯一标识符。DNS label prefix: enter a unique identifier to use as part of the DNS label.
Ubuntu OS 版本:选择想要在 VM 上运行的 Ubuntu 版本。Ubuntu OS version: select which version of Ubuntu you want to run on the VM.
位置:默认与资源组位置相同(如果已存在)。Location: the default is the same location as the resource group, if it already exists.
VM 大小:选择要用于 VM 的大小。VM size: select the size to use for the VM.
虚拟网络名称:要用于 vNet 的名称。Virtual Network Name: name to be used for the vNet.
子网名称:VM 应使用的子网的名称。Subnet Name: name for the subnet the VM should use.
网络安全组名称:NSG 的名称。Network Security Group Name: name for the NSG.
选择“查看 + 创建”。Select Review + create. 验证完成后,选择“创建”以创建和部署 VM。After validation completes, select Create to create and deploy the VM.
使用 Azure 门户部署模板。The Azure portal is used to deploy the template. 除了 Azure 门户,还可以使用 Azure CLI、Azure PowerShell 和 REST API。In addition to the Azure portal, you can also use the Azure CLI, Azure PowerShell, and REST API. 若要了解其他部署方法,请参阅部署模板。To learn other deployment methods, see Deploy templates.
查看已部署的资源Review deployed resources
你可以使用 Azure 门户来检查 VM 和创建的其他资源。You can use the Azure portal to check on the VM and other resource that were created. 部署完成后,请选择“转到资源组”以查看 VM 和其他资源。After the deployment is finished, select Go to resource group to see the VM and other resources.
清理资源Clean up resources
如果不再需要资源组,可以将其删除,这将删除 VM 和资源组中的所有资源。When no longer needed, delete the resource group, which deletes the VM and all of the resources in the resource group.
选择“资源组”。Select the Resource group.
在资源组页上,选择“删除”。On the page for the resource group, select Delete.
出现提示时,键入资源组的名称,然后选择“删除”。When prompted, type the name of the resource group and then select Delete.
后续步骤Next steps
在本快速入门中,你已使用 ARM 模板部署了一个简单的虚拟机。In this quickstart, you deployed a simple virtual machine using an ARM template. 若要详细了解 Azure 虚拟机,请继续学习 Linux VM 的教程。To learn more about Azure virtual machines, continue to the tutorial for Linux VMs.