为 Azure 逻辑应用部署 Azure 资源管理器模板Deploy Azure Resource Manager templates for Azure Logic Apps

创建用于逻辑应用的 Azure 资源管理器模板后,可按以下方式部署该模板:After you create an Azure Resource Manager template for your logic app, you can deploy your template in these ways:

通过 Azure 门户进行部署Deploy through Azure portal

若要自动将逻辑应用模板部署到 Azure,可以选择下面的“部署到 Azure”按钮,这样可以登录到 Azure 门户,系统会提示你输入有关逻辑应用的信息。To automatically deploy a logic app template to Azure, you can choose the following Deploy to Azure button, which signs you in to the Azure portal and prompts you for information about your logic app. 然后,可对逻辑应用模板或参数进行任何必要的更改。You can then make any necessary changes to the logic app template or parameters.

“部署到 Azure”Deploy to Azure

例如,在登录到 Azure 门户后,系统会提示输入以下信息:For example, you're prompted for the following information after you sign in to the Azure portal:

  • Azure 订阅名称Azure subscription name
  • 要使用的资源组Resource group that you want to use
  • 逻辑应用位置Logic app location
  • 逻辑应用的名称The name for your logic app
  • 测试 URIA test URI
  • 接受指定的条款和条件Acceptance of the specified terms and conditions

有关详细信息,请参阅以下主题:For more information, see these topics:

使用 Visual Studio 进行部署Deploy with Visual Studio

若要从使用 Visual Studio 创建的 Azure 资源组项目部署逻辑应用模板,请按这些步骤操作,将逻辑应用手动部署到 Azure。To deploy a logic app template from an Azure Resource Group project that you created by using Visual Studio, follow these steps to manually deploy your logic app to Azure.

使用 Azure PowerShell 部署Deploy with Azure PowerShell

若要部署到特定的 Azure 资源组,请使用以下命令:To deploy to a specific Azure resource group, use the following command:

New-AzResourceGroupDeployment -ResourceGroupName <Azure-resource-group-name> -TemplateUri https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-logic-app-create/azuredeploy.json

有关详细信息,请参阅以下主题:For more information, see these topics:

使用 Azure CLI 进行部署Deploy with Azure CLI

若要部署到特定的 Azure 资源组,请使用以下命令:To deploy to a specific Azure resource group, use the following command:

az group deployment create -g <Azure-resource-group-name> --template-uri https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/101-logic-app-create/azuredeploy.json

有关详细信息,请参阅以下主题:For more information, see these topics:

使用 Azure DevOps 进行部署Deploy with Azure DevOps

若要部署逻辑应用模板并管理环境,团队通常会使用 Azure DevOps 中的 Azure Pipelines 等工具。To deploy logic app templates and manage environments, teams commonly use a tool such as Azure Pipelines in Azure DevOps. Azure Pipelines 提供一个可以添加到任何生成管道或发布管道的 Azure 资源组部署任务Azure Pipelines provides an Azure Resource Group Deployment task that you can add to any build or release pipeline. 若要授权部署和生成发布管道,还需要一个 Azure Active Directory (AD) 服务主体For authorization to deploy and generate the release pipeline, you also need an Azure Active Directory (AD) service principal. 详细了解如何在 Azure Pipelines 中使用服务主体Learn more about using service principals with Azure Pipelines.

若要详细了解如何使用 Azure Pipelines 进行与 Azure 资源管理器模板相对应的持续集成和持续部署 (CI/CD),请参阅以下主题和示例:For more information about continuous integration and continuous deployment (CI/CD) for Azure Resource Manager templates with Azure Pipelines, see these topics and samples:

下面是有关使用 Azure Pipelines 的一般性概要步骤:Here are the general high-level steps for using Azure Pipelines:

  1. 在 Azure Pipelines 中创建空管道。In Azure Pipelines, create an empty pipeline.

  2. 选择管道所需的资源,例如,手动生成的或者在生成过程中生成的逻辑应用模板和模板参数文件。Choose the resources you need for the pipeline, such as your logic app template and template parameters files, which you generate manually or as part of the build process.

  3. 对于代理作业,请找到并添加“Azure 资源组部署”任务。For your agent job, find and add the Azure Resource Group Deployment task.

    添加“Azure 资源组部署”任务

  4. 使用服务主体进行配置。Configure with a service principal.

  5. 添加对逻辑应用模板和模板参数文件的引用。Add references to your logic app template and template parameters files.

  6. 继续在发布过程中根据需要为其他任何环境、自动测试或审批程序构建步骤。Continue to build out steps in the release process for any other environment, automated test, or approvers as needed.

授权 OAuth 连接Authorize OAuth connections

部署后,逻辑应用将使用有效参数进行端到端的运行。After deployment, your logic app works end-to-end with valid parameters. 但是,仍然必须授权任何 OAuth 连接,以生成用于对凭据进行身份验证的有效访问令牌。However, you must still authorize any OAuth connections to generate valid access tokens for authenticating your credentials. 下面是可以用来授权 OAuth 连接的方式:Here are ways that you can authorize OAuth connections:

  • 若要进行自动部署,可以使用脚本为每个 OAuth 连接提供许可。For automated deployments, you can use a script that provides consent for each OAuth connection. 下面是 GitHub 中的一个示例脚本,位于 LogicAppConnectionAuth 项目中。Here's an example script in GitHub in the LogicAppConnectionAuth project.

  • 若要手动授权 OAuth 连接,请在 Azure 门户或 Visual Studio 的逻辑应用设计器中打开逻辑应用。To manually authorize OAuth connections, open your logic app in Logic App Designer, either in the Azure portal or in Visual Studio. 在设计器中,授权任何必需的连接。In the designer, authorize any required connections.

如果改用 Azure Active Directory (Azure AD) 服务主体来授权连接,请了解如何在逻辑应用模板中指定服务主体参数If you use an Azure Active Directory (Azure AD) service principal instead to authorize connections, learn how to specify service principal parameters in your logic app template.

后续步骤Next steps