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

本文说明如何将 Azure 门户Azure 资源管理器配合使用来部署 Azure 资源。This article shows 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.

创建资源组Create resource group

  1. 若要创建空资源组,请选择“资源组”。To create an empty resource group, select Resource groups.


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


  3. 为其命名并指定位置,如有必要,选择一个订阅。Give it a name and location, and, if necessary, select a subscription. 需要提供资源组的位置,因为资源组存储与资源有关的元数据。You need to provide a location for the resource group because 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.


    完成属性设置后,选择“创建”。When you have finished setting the properties, select Create.

  4. 若要查看新资源组,选择“刷新”。To see your new resource group, select Refresh.


从市场部署资源Deploy resources from Marketplace

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

  1. 若要开始部署,请选择“创建资源”。To start a deployment, select Create a resource.


  2. 查找希望部署的资源类型。Find the type of resource you would like to deploy.


  3. 如果看不到想要部署的特定解决方案,可以在市场中搜索。If you don't see the particular solution you would like to deploy, you can search the Marketplace for it. 例如,若要查找 Wordpress 解决方案,开始键入 Wordpress 并选择所需选项。For example, to find a Wordpress solution, start typing Wordpress and select the option you want.


  4. 根据所选资源的类型,需要在部署之前设置相关属性的集合。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. 以下映像演示了如何创建 Web 应用并将其部署到创建的资源组。The following image shows how to create a web app 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.


  5. 部署开始。Your deployment begins. 部署可能需要几分钟的时间。The deployment could take a few minutes. 完成部署后,会看到一条通知。When the deployment has finished, you see a notification.


  6. 部署资源后,可以通过选择“添加”将更多资源添加到资源组。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, and search for Template Deployment until you can select it from the options.


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


  3. 此时,会看到用于创建模板的几个选项。You see several options for creating a template. 选择“在编辑器中生成自己的模板”。Select Build your own template in the editor.


  4. 你已具有可用于自定义的空白模板。You have a blank template that is available for customizing.


  5. 可以手动编辑 JSON 语法,也可以从模板库快速入门中选择预建模板。You can edit the JSON syntax manually, or select a pre-built template from the Quickstart template gallery. 但是,本文使用的是“添加资源”选项。However, for this article, you use the Add resource option.


  6. 选择“存储帐户”并为其提供名称。Select Storage account and provide a name. 完成提供值后,选择“确定”。When finished providing values, select OK.


  7. 编辑器会自动为资源类型添加 JSON。The editor automatically adds JSON for the resource type. 请注意,它包含用于定义存储帐户类型的参数。Notice that it includes a parameter for defining the type of storage account. 选择“其他安全性验证” 。Select Save.


  8. 现在,可以选择部署模板中定义的资源。Now, you have the option to deploy the resources defined in the template. 若要部署,请同意条款和条件,然后选择“购买”。To deploy, agree to the terms and conditions, and select Purchase.


从保存到帐户中的模板部署资源Deploy resources from a template saved to your account

该门户允许用户将模板保存到 Azure 帐户,以便以后重新部署它。The portal enables you to save a template to your Azure account, and redeploy it later. 有关模板的详细信息,请参阅创建和部署第一个 Azure 资源管理器模板For more information on templates, see Create and deploy your first Azure Resource Manager template.

  1. 若要查找已保存模板,请选择“更多服务”。To find your saved templates, select More services.


  2. 搜索模板并选择该选项。Search for templates and select that option.


  3. 从已保存到帐户的模板列表中,选择要使用的模板。From the list of templates saved to your account, select the one you wish to work on.


  4. 选择“部署” 以重新部署该已保存模板。Select Deploy to redeploy this saved template.


后续步骤Next steps