Azure 逻辑应用的常见方案、示例、教程和演练Common scenarios, examples, tutorials, and walkthroughs for Azure Logic Apps

Azure 逻辑应用提供数百个随时可用的连接器(从 SQL Server 或 SAP 到 Azure 认知服务,不一而足),可帮助你安排和集成不同的服务。Azure Logic Apps helps you orchestrate and integrate different services by providing hundreds of ready-to-use connectors, ranging from SQL Server or SAP to Azure Cognitive Services. 逻辑应用服务“无服务器”,因此无需担心规模或实例。The Logic Apps service is "serverless", so you don't have to worry about scale or instances. 只需定义带有触发器的工作流和工作流执行的操作。All you have to do is define the workflow with a trigger and the actions that the workflow performs. 基础平台处理缩放、可用性和性能。The underlying platform handles scale, availability, and performance. 逻辑应用尤其适用于需要在多个系统和服务中协调操作的用例和方案。Logic Apps is especially useful for use cases and scenarios where you need to coordinate actions across multiple systems and services.

为帮助你了解 Azure 逻辑应用支持的功能和模式,本文介绍了一些常见的起点、示例和方案。To help you learn about the capabilities and patterns that Azure Logic Apps supports, this article describes common starting points, examples, and scenarios.

逻辑应用工作流的常用起点Common starting points for logic app workflows

每个逻辑应用均由触发器启动,并且只有一个触发器,该触发器可启动逻辑应用工作流并将任何数据作为该触发器的一部分进行传递。Every logic app starts with a trigger, and only one trigger, which starts your logic app workflow and passes in any data as part of that trigger. 某些连接器提供触发器,类型包括:Some connectors provide triggers, which come in these types:

  • 轮询触发器:定期检查服务终结点以获取新数据。Polling triggers: Regularly checks a service endpoint for new data. 如果存在新数据,触发器会创建并运行新的工作流实例(将数据作为输入)。When new data exists, the trigger creates and runs a new workflow instance with the data as input.

  • 推送触发器:侦听服务终结点上的数据并等到特定事件发生。Push triggers: Listens for data at a service endpoint and waits until a specific event happens. 事件发生时触发器会立即触发,创建并运行新的工作流实例(将任何可用数据用作输入)。When the event happens, the trigger fires immediately, creating and running a new workflow instance that uses any available data as input.

下面是描述常用触发器的示例:Here are examples that describe commonly-used triggers:

发生指定的事件后,触发器随即触发,创建新的逻辑应用工作流实例并在工作流中运行操作。After the specified event happens, the trigger fires, which creates a new logic app workflow instance and runs the actions in the workflow. 通过工作流可访问触发器中任何数据。You can access any data from the trigger throughout the workflow. 例如,Twitter 的“发布新推文时”触发器会将推文内容传递到逻辑应用运行中。For example, the Twitter On a new tweet trigger passes the tweet content into the logic app run. 若要开始使用 Azure 逻辑应用,请尝试以下快速入门主题:To get started with Azure Logic Apps, try these quickstart topics:

控制流和错误处理功能Control flow and error handling capabilities

逻辑应用包括高级控制流(例如条件、开关、循环和作用域)的丰富功能。Logic apps include rich capabilities for advanced control flow, such as conditions, switches, loops, and scopes. 若要确保解决方案具有弹性,还可以在工作流中实现错误和异常处理。To ensure resilient solutions, you can also implement error and exception handling in your workflows.

创建自定义 API 和连接器Create custom APIs and connectors

对于没有已发布的连接器的系统和服务,也可以扩展逻辑应用。For systems and services that don't have published connectors, you can also extend logic apps.

构建企业对企业 (B2B) 解决方案Build business-to-business (B2B) solutions

若要实现企业集成解决方案并在组织之间无缝通信,可以结合 Azure 逻辑应用使用 Enterprise Integration Pack (EIP) 针对这些方案构建自动化的可缩放工作流。For enterprise integration solutions and seamless communication between organizations, you can build automated scalable workflows for these scenarios by using the Enterprise Integration Pack (EIP) with Azure Logic Apps. 尽管组织使用不同的协议和格式,但它们仍可以通过电子方式交换消息。Although organizations use different protocols and formats, they can exchange messages electronically. EIP 会将不同的格式转换为组织的系统可以处理的格式,并支持 AS2、X12、EDIFACT 和 RosettaNet 等行业标准协议。The EIP transforms different formats into a format that your organizations' systems can process and supports industry-standard protocols, including AS2, X12, EDIFACT, and RosettaNet. 若要构建这些解决方案,请创建一个集成帐户。该集成帐户是一个单独的 Azure 资源,为你所定义的与逻辑应用工作流配合使用的项目提供安全、可缩放且可管理的容器。To build these solutions, you create an integration account, which is a separate Azure resource that provides a secure, scalable, and manageable container for the artifacts that you define and use with your logic app workflows. 例如,项目包括贸易合作伙伴、协议、映射、架构、证书和批配置。For example, artifacts include trading partners, agreements, maps, schemas, certificates, and batch configurations.

部署、管理和监视逻辑应用Deploy, manage, and monitor logic apps

可以使用 Visual Studio、Azure DevOps,或任何其他源代码管理和自动生成工具充分开发和部署逻辑应用。You can fully develop and deploy logic apps with Visual Studio, Azure DevOps, or any other source control and automated build tools. 为了支持资源模板中工作流和从属连接的部署,逻辑应用使用 Azure 资源部署模板。To support deployment for workflows and dependent connections in a resource template, logic apps use Azure resource deployment templates. Visual Studio 工具会自动生成这些模板,可以在源代码管理中签入这些模板以进行版本控制。Visual Studio tools automatically generate these templates, which you can check in to source control for versioning. 如需有关工作流运行状态的通知和诊断日志,Azure 逻辑应用还提供了监视和警报。For notification and diagnostic logs for workflow run status, Azure Logic Apps also provides monitoring and alerts.

部署Deploy

监视Monitor

处理内容类型、转换和变换Handle content types, conversions, and transformations

可以使用 Azure 逻辑应用工作流定义语言中的多个函数访问、转换和变换多个内容类型。You can access, convert, and transform multiple content types by using the many functions in the Azure Logic Apps workflow definition language. 例如,可以使用 @json()@xml() 工作流表达式在字符串、JSON 和 XML 之间转换。For example, you can convert between a string, JSON, and XML with the @json() and @xml() workflow expressions. 逻辑应用引擎通过保留内容类型,来支持在服务之间以无损方式进行内容传输。The Logic Apps engine preserves content types to support content transfer in a lossless manner between services.

其他集成和功能Other integrations and capabilities

Azure 逻辑应用集成许多服务,例如 Azure Functions、Azure API 管理、Azure 应用服务和自定义 HTTP 终结点(例如 REST 和 SOAP)。Azure Logic Apps integrates with many services, such as Azure Functions, Azure API Management, Azure App Service, and custom HTTP endpoints, for example, REST and SOAP.

端到端方案End-to-end scenarios

客户案例Customer stories

了解 Azure 逻辑应用以及其他 Azure 服务和 Microsoft 产品如何通过简化、组织、自动执行和协调复杂流程帮助这些公司提高其灵活性并集中精力处理其核心业务。Learn how Azure Logic Apps, along with other Azure services and Microsoft products, helped these companies improve their agility and focus on their core businesses by simplifying, organizing, automating, and orchestrating complex processes.

后续步骤Next steps