什么是 Azure 逻辑应用?What is Azure Logic Apps?

Azure 逻辑应用是一项云服务,用于在需要跨企业或组织集成应用、数据、系统和服务时计划、自动执行和协调任务、业务流程和工作流Azure Logic Apps is a cloud service that helps you schedule, automate, and orchestrate tasks, business processes, and workflows when you need to integrate apps, data, systems, and services across enterprises or organizations. 逻辑应用可简化可缩放解决方案的设计和构建方式,适用于应用集成、数据集成、系统集成、企业应用程序集成 (EAI) 和企业到企业 (B2B) 通信,不管是在云中还是在本地。Logic Apps simplifies how you design and build scalable solutions for app integration, data integration, system integration, enterprise application integration (EAI), and business-to-business (B2B) communication, whether in the cloud, on premises, or both.

例如,下面就是一些可以通过逻辑应用自动完成的工作负荷:For example, here are just a few workloads you can automate with logic apps:

  • 跨本地系统和云服务处理并路由订单。Process and route orders across on-premises systems and cloud services.
  • 当各种系统、应用和服务中发生事件时,使用 Office 365 发送电子邮件通知。Send email notifications with Office 365 when events happen in various systems, apps, and services.
  • 将上传的文件从 SFTP 或 FTP 服务器移至 Azure 存储。Move uploaded files from an SFTP or FTP server to Azure Storage.
  • 监视推文中的特定主题,分析观点,针对需要查看的项目创建警报或任务。Monitor tweets for a specific subject, analyze the sentiment, and create alerts or tasks for items that need review.

若要使用 Azure 逻辑应用生成企业集成解决方案,可以从一个不断扩充的库中进行选择。该库包含 200 多个连接器,包括各种服务,例如 Azure 服务总线、Functions、存储;SQL、Office 365、Dynamics、Salesforce、BizTalk、SAP、Oracle DB、文件共享,等等。To build enterprise integration solutions with Azure Logic Apps, you can choose from a growing gallery with 200+ connectors, which include services such as Azure Service Bus, Functions, and Storage; SQL, Office 365, Dynamics, Salesforce, BizTalk, SAP, Oracle DB, file shares, and more. 连接器提供触发器和/或操作,所创建的逻辑应用可以安全地对数据进行实时访问和处理。Connectors provide triggers, actions, or both for creating logic apps that securely access and process data in real time.

逻辑应用的工作原理How does Logic Apps work?

每个逻辑应用工作流都从触发器开始,在发生特定事件或新的可用数据符合特定条件的情况下触发。Every logic app workflow starts with a trigger, which fires when a specific event happens, or when new available data meets specific criteria. 许多触发器包括基本的计划功能,用于指定工作负荷的运行频率。Many triggers include basic scheduling capabilities so that you can specify how regularly your workloads run. 若要获取更多自定义计划方案,请使用计划触发器启动工作流。For more custom scheduling scenarios, start your workflows with the Schedule trigger.

每当触发器触发时,逻辑应用引擎就会创建一个逻辑应用实例来运行工作流中的操作。Each time that the trigger fires, the Logic Apps engine creates a logic app instance that runs the actions in the workflow. 这些操作也可包括数据转换和流控制,如条件语句、开关语句、循环和分支。These actions can also include data conversions and flow controls, such as conditional statements, switch statements, loops, and branching. 例如,以下逻辑应用通过 Dynamics 365 触发器启动,带有内置的条件“当更新记录时”。For example, this logic app starts with a Dynamics 365 trigger with the built-in criteria "When a record is updated". 触发器在检测到与此条件匹配的事件时,会触发并运行工作流的操作。If the trigger detects an event that matches this criteria, the trigger fires and runs the workflow's actions. 在这里,这些操作包括 XML 转换、数据更新、决策分支和电子邮件通知。Here, these actions include XML transformation, data updates, decision branching, and email notifications.

逻辑应用设计器 - 示例逻辑应用

可以使用逻辑应用设计器直观地构建逻辑应用。该设计器可通过浏览器在 Azure 门户中获取,也可在 Visual Studio 中获取。You can build your logic apps visually with the Logic Apps Designer, which is available in the Azure portal through your browser and in Visual Studio. 若要获取更多的自定义逻辑应用,可以使用“代码视图”编辑器以 JavaScript 对象表示法 (JSON) 创建或编辑逻辑应用定义。For more custom logic apps, you can create or edit logic app definitions in JavaScript Object Notation (JSON) by working in the "code view" editor. 也可对选定的任务使用 Azure PowerShell 命令和 Azure 资源管理器模板。You can also use Azure PowerShell commands and Azure Resource Manager templates for select tasks. 逻辑应用部署和运行在 Azure 云中。Logic apps deploy and run in the cloud on Azure.

为什么使用逻辑应用?Why use Logic Apps?

随着企业逐渐转向数字化,逻辑应用应运而生。它可以提供预生成的 API 作为 Microsoft 托管的连接器,从而可以更轻松快捷地连接旧式、新式和前沿的系统。With businesses moving toward digitization, logic apps help you connect legacy, modern, and cutting-edge systems more easily and quickly by providing prebuilt APIs as Microsoft-managed connectors. 因此,你可以专注于应用的业务逻辑和功能,That way, you can focus on your apps' business logic and functionality. 不需担心应用的生成、托管、缩放、管理、维护和监视。You don't have to worry about building, hosting, scaling, managing, maintaining, and monitoring your apps. 逻辑应用为你解决这一切。Logic Apps handles these concerns for you. 另外,只需根据使用情况付费,具体取决于使用量定价模型Plus, you pay only for what you use based on a consumption pricing model.

在许多情况下,无需编写代码。In many cases, you won't have to write code. 但如果必须编写一些代码,则可使用 Azure Functions 创建代码片段,然后通过逻辑应用按需运行该代码。But if you must write some code, you can create code snippets with Azure Functions and run that code on-demand from logic apps.

逻辑应用、Functions 和事件网格由 Azure 全权托管,因此不必担心解决方案的生成、托管、缩放、管理、监视和维护。Logic Apps, Functions, and Event Grid are fully managed by Azure, which frees you from worries about building, hosting, scaling, managing, monitoring, and maintaining your solutions. 由于能够创建“无服务器”应用和解决方案,因此只需关注业务逻辑。With the capability to create "serverless" apps and solutions, you can just focus on the business logic. 这些服务可以按需自动缩放,加快集成速度,使用最少的代码生成可靠的云应用。These services automatically scale to meet your needs, make integrations faster, and help you build robust cloud apps with minimal code. 另外,只需根据使用情况付费,具体取决于使用量定价模型Plus, you pay only for what you use, based on a consumption pricing model.

若要了解公司如何将逻辑应用与其他 Azure 服务和 Microsoft 产品配合使用,以便增强敏捷性并更加专注于核心业务,请查看这些客户案例To learn how companies improved their agility and increased focus on their core businesses when they combined Logic Apps with other Azure services and Microsoft products, check out these customer stories.

下面更详细地介绍逻辑应用的功能和好处:Here are more details about the capabilities and benefits that you get with Logic Apps:

使用易用的工具直观地生成工作流Visually build workflows with easy-to-use tools

使用可视化设计工具,既节省时间,又能简化复杂的流程。Save time and simplify complex processes with visual design tools. 从头至尾使用逻辑应用设计器来生成逻辑应用,不管是通过浏览器在 Azure 门户中使用,还是在 Visual Studio 中使用。Build logic apps from start-to-finish by using the Logic Apps Designer through your browser in the Azure portal or in Visual Studio. 使用触发器启动工作流,并从连接器库添加任意数量的操作。Start your workflow with a trigger, and add any number of actions from the connectors gallery.

使用逻辑应用模板加快入门速度Get started faster with logic app templates

模板库选择预定义的工作流时,可以更快速地创建常用解决方案。Create commonly used solutions more quickly when you choose predefined workflows from the template gallery. 模板既有适用于软件即服务 (SaaS) 应用的简单连接,也有高级 B2B 解决方案,还有“兴趣型”模板。Templates range from simple connectivity for software-as-a-service (SaaS) apps to advanced B2B solutions plus "just for fun" templates. 了解如何从预生成的模板创建逻辑应用Learn how to create logic apps from prebuilt templates.

跨不同的环境连接不同的系统Connect disparate systems across different environments

某些模式和工作流描述起来容易,但难以在代码中实现。Some patterns and workflows are easy to describe but hard to implement in code. 逻辑应用可用于跨本地环境和云环境无缝连接不同的系统。Logic apps help you seamlessly connect disparate systems across on-premises and cloud environments. 例如,可以将云营销解决方案连接到本地计费系统,也可以使用企业服务总线集中进行跨 API 和系统的消息传送。For example, you can connect a cloud marketing solution to an on-premises billing system, or centralize messaging across APIs and systems with an Enterprise Service Bus. 可以通过逻辑应用快速、可靠且一致地为这些方案提供可重复使用和重新配置的解决方案。Logic apps provide a fast, reliable, and consistent way to deliver reusable and reconfigurable solutions for these scenarios.

编写一次即可多次重复使用Write once, reuse often

将逻辑应用作为模板创建,然后即可跨多个环境和区域部署和重新配置应用Create your logic apps as templates so that you can deploy and reconfigure your apps across multiple environments and regions.

内置的扩展性Built-in extensibility

如果找不到所需的连接器,或者需要运行自定义代码,则可通过 Azure Functions 根据需要创建和调用自己的代码片段,从而扩展逻辑应用。If you don't find the connector that you want or need to run custom code, you can extend logic apps by creating and calling your own code snippets on-demand through Azure Functions. 创建自己的 API自定义连接器,以便通过逻辑应用对其进行调用。Create your own APIs and custom connectors that you can call from logic apps.

只需为使用的服务付费Pay only for what you use

逻辑应用使用基于使用情况的定价和计费,除非该逻辑应用是以前使用应用服务计划创建的。Logic Apps uses consumption-based pricing and metering unless you have logic apps previously created with App Service plans.

关键术语Key terms

  • 工作流:以一系列步骤的方式完成业务流程的可视化、设计、生成、自动化和部署操作。Workflow: Visualize, design, build, automate, and deploy business processes as series of steps.

  • 托管连接器:逻辑应用需要访问数据、服务和系统。Managed connectors: Your logic apps need access to data, services, and systems. 可以使用预生成的 Microsoft 托管连接器,这些连接器旨在连接、访问和使用数据。You can use prebuilt Microsoft-managed connectors that are designed to connect, access, and work with your data. 请参阅适用于 Azure 逻辑应用的连接器See Connectors for Azure Logic Apps

  • 触发器:许多 Microsoft 托管连接器提供的触发器可以在事件或新数据符合指定条件时触发。Triggers: Many Microsoft-managed connectors provide triggers that fire when events or new data meet specified conditions. 例如,某个事件可能正在获取电子邮件或检测 Azure 存储帐户中的更改。For example, an event might be getting an email or detecting changes in your Azure Storage account. 每当触发器触发时,逻辑应用引擎就会创建一个新的逻辑应用实例来运行工作流。Each time the trigger fires, the Logic Apps engine creates a new logic app instance that runs the workflow.

  • 操作:操作是在触发器之后发生的所有步骤。Actions: Actions are all the steps that happen after the trigger. 每个操作通常都会映射到由托管连接器、自定义 API 或自定义连接器定义的操作。Each action usually maps to an operation that's defined by a managed connector, custom API, or custom connector.

  • Enterprise Integration Pack:对于更高级的集成方案,逻辑应用会包括 BizTalk Server 中的功能。Enterprise Integration Pack: For more advanced integration scenarios, Logic Apps includes capabilities from BizTalk Server. Enterprise Integration Pack 提供的连接器可以帮助逻辑应用轻松地执行验证、转换等操作。The Enterprise Integration Pack provides connectors that help logic apps easily perform validation, transformation, and more.

逻辑应用与 Functions、WebJobs 及 Flow 的区别在哪里?How does Logic Apps differ from Functions, WebJobs, and Flow?

所有这些服务都可以用来将不同的系统“粘贴”和连接到一起。All these services help you "glue" and connect disparate systems together. 每项服务都有其优点和优势,因此若要快速生成可缩放且功能完备的集成系统,最好的方法是将这些服务的功能组合到一起。Each service has their advantages and benefits, so combining their capabilities is the best way to quickly build a scalable, full-featured integration system.

入门Get started

逻辑应用是托管在 Microsoft Azure 上的许多服务之一。Logic Apps is one of the many services hosted on Microsoft Azure. 因此在开始之前,你需要一个 Azure 订阅。So before you start, you need an Azure subscription. 如果没有订阅,可以注册 Azure 试用帐户If you don't have a subscription, sign up for a trial Azure account.

如果有 Azure 订阅,可以尝试此创建第一个逻辑应用的快速入门。该逻辑应用通过 RSS 源监视网站上的新内容,在新内容出现时发送电子邮件。If you have an Azure subscription, try this quickstart to create your first logic app, which monitors new content on a website through an RSS feed and sends email when new content appears.

后续步骤Next steps