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

使用 Resource Manager 模板和 Azure 门户部署资源Deploy resources with Resource Manager templates and Azure portal

了解如何通过azure 资源管理器使用Azure 门户来部署 azure 资源。Learn how to use the Azure portal with Azure Resource Manager to deploy your Azure resources. 若要了解有关管理资源的信息,请参阅使用 Azure 门户管理 Azure 资源To learn about managing your resources, see Manage Azure resources by using the Azure portal.

使用 Azure 门户部署 Azure 资源通常涉及两个步骤:Deploying Azure resources by using the Azure portal usually involves two steps:

  • 创建资源组。Create a resource group.
  • 将资源部署到资源组。Deploy resources to the resource group.

此外,还可以部署 Azure 资源管理器模板来创建 Azure 资源。In addition, you can also deploy an Azure Resource Manager template to create Azure resources.

本文介绍了这两种方法。This article shows both methods.

创建资源组Create a resource group

  1. 若要创建新的资源组,请从 " Azure 门户中选择"资源组"。To create a new resource group, select Resource groups from the Azure portal.

    选择资源组

  2. 在“资源组”下,选择“添加”。Under Resource groups, select Add.

    添加资源组

  3. 选择或输入以下属性值:Select or enter the following property values:

    • 订阅:选择一个 Azure 订阅。Subscription: Select an Azure subscription.
    • 资源组:为资源组指定一个名称。Resource group: Give the resource group a name.
    • 区域:指定 Azure 位置。Region: Specify an Azure location. 这是资源组存储有关资源的元数据的位置。This is where the resource group stores metadata about the resources. 出于合规目的,你可能需要指定该元数据的存储位置。For compliance reasons, you may want to specify where that metadata is stored. 一般情况下,建议指定大部分资源将驻留的位置。In general, we recommend that you specify a location where most of your resources will reside. 使用相同位置可简化模板。Using the same location can simplify your template.

    设置组的值

  4. 选择“查看 + 创建”。Select Review + create.

  5. 查看值,然后选择 "创建"。review the values, and then select Create.

  6. 选择 "刷新",然后才能在列表中看到新的资源组。Select Refresh before you can see the new resource group in the list.

将资源部署到资源组Deploy resources to a resource group

创建资源组后,可以将资源从 Marketplace 部署到组。After you create a resource group, you can deploy resources to the group from the Marketplace. 市场为常见方案提供预定义的解决方案。The Marketplace provides pre-defined solutions for common scenarios.

  1. 若要开始部署,请从Azure 门户中选择 "创建资源"。To start a deployment, select Create a resource from the Azure portal.

    新建资源

  2. 查找希望部署的资源类型。Find the type of resource you would like to deploy. 资源按类别进行组织。The resources are organized in categories. 如果看不到想要部署的特定解决方案,可以在市场中搜索。If you don't see the particular solution you would like to deploy, you can search the Marketplace for it. 以下屏幕截图显示已选择 Ubuntu 服务器。The following screenshot shows that Ubuntu Server is selected.

    选择“资源类型”

  3. 根据所选资源的类型,需要在部署之前设置相关属性的集合。Depending on the type of selected resource, you have a collection of relevant properties to set before deployment. 对于所有类型,必须选择目标资源组。For all types, you must select a destination resource group. 下图显示了如何创建 Linux 虚拟机并将其部署到创建的资源组。The following image shows how to create a Linux virtual machine and deploy it to the resource group you created.

    创建资源组

    也可以在部署资源时创建资源组。Alternatively, you can decide to create a resource group when deploying your resources. 选择“新建”并为资源组指定名称。Select Create new and give the resource group a name.

  4. 部署开始。Your deployment begins. 部署可能需要几分钟的时间。The deployment could take several minutes. 某些资源比其他资源花费的时间更长。Some resources take longer time than other resources. 完成部署后,会看到一条通知。When the deployment has finished, you see a notification. 选择 "中转到资源" 打开Select Go to resource to open

    查看通知

  5. 部署资源后,可以通过选择“添加”将更多资源添加到资源组。After deploying your resources, you can add more resources to the resource group by selecting Add.

    添加资源

从自定义模板部署资源Deploy resources from custom template

如果想要执行部署,但不使用市场中的任何模板,可以创建自定义模板来针对解决方案定义基础结构。If you want to execute a deployment but not use any of the templates in the Marketplace, you can create a customized template that defines the infrastructure for your solution. 若要了解如何创建模板,请参阅了解 Azure 资源管理器模板的结构和语法To learn about creating templates, see Understand the structure and syntax of Azure Resource Manager templates.

备注

门户界面不支持引用来自 Key Vault 的密码The portal interface doesn't support referencing a secret from a Key Vault. 请改用 PowerShellAzure CLI,从本地或从外部 URI 部署模板。Instead, use PowerShell or Azure CLI to deploy your template locally or from an external URI.

  1. 若要通过门户部署自定义模板,请选择 "创建资源",然后搜索 "模板"。To deploy a customized template through the portal, select Create a resource, search for template. 然后选择模板部署and then select Template deployment.

    搜索模板部署

  2. 选择创建Select Create.

  3. 你会看到用于创建模板的几个选项:You see several options for creating a template:

    • 在编辑器中生成自己的模板:使用门户模板编辑器创建模板。Build your own template in editor: create a template using the portal template editor. 编辑器能够添加资源模板架构。The editor is capable to add a resource template schema.
    • 常见模板:创建 Linux 虚拟机、Windows 虚拟机、web 应用程序和 Azure SQL 数据库有四个常见 templatess。Common templates: There are four common templatess for creating a Linux virtual machine, Windows virtual machine, a web application, and an Azure SQL database.
    • 加载 GitHub 快速入门模板:使用现有的快速入门模板Load a GitHub quickstart template: use an existing quickstart templates.

    视图选项

    本教程提供了有关加载快速入门模板的说明。This tutorial provides the instruction for loading a quickstart template.

  4. 在 "加载 GitHub 快速入门模板" 下,键入或选择 " 101-存储-创建"。Under Load a GitHub quickstart template, type or select 101-storage-account-create.

    可以使用两个选项:You have two options:

    • 选择模板:部署模板。Select template: deploy the template.
    • 编辑模板:在部署快速入门模板之前对其进行编辑。Edit template: edit the quickstart template before you deploy it.
  5. 选择 "编辑模板",浏览门户模板编辑器。Select Edit template to explore the portal template editor. 模板将加载到编辑器中。The template is loaded in the editor. 请注意,有两个参数: storageAccountTypelocationNotice there are two parameters: storageAccountType and location.

    创建模板

  6. 对模板进行较小的更改。Make a minor change to the template. 例如,将storageAccountName变量更新为:For example, update the storageAccountName variable to:

    "storageAccountName": "[concat('azstore', uniquestring(resourceGroup().id))]"
    
  7. 选择“保存”。Select Save. 现在,你会看到 "门户模板部署" 界面。Now you see the portal template deployment interface. 请注意模板中定义的两个参数。Notice the two parameters that you defined in the template.

  8. 输入或选择属性值:Enter or select the property values:

    • 订阅:选择一个 Azure 订阅。Subscription: Select an Azure subscription.
    • 资源组:选择 "新建" 并指定一个名称。Resource group: Select Create new and give a name.
    • 位置:选择 Azure 位置。Location: Select an Azure location.
    • 存储帐户类型:使用默认值。Storage Account Type: Use the default value.
    • 位置:使用默认值。Location: Use the default value.
    • 我同意上述条款和条件:(选中)I agree to the terms and conditions stated above: (select)
  9. 选择“购买”。Select Purchase.

后续步骤Next steps