适用于 Azure 逻辑应用的连接器Connectors for Azure Logic Apps
使用连接器可以从 Azure 逻辑应用快速访问其他应用、服务、系统、协议和平台上的事件、数据和操作。Connectors provide quick access from Azure Logic Apps to events, data, and actions across other apps, services, systems, protocols, and platforms. 使用逻辑应用中的连接器,可以扩展云中和本地应用的功能,以便对创建的数据和现有的数据执行任务。By using connectors in your logic apps, you expand the capabilities for your cloud and on-premises apps to perform tasks with the data that you create and already have.
虽然逻辑应用提供数百个连接器,但本文只介绍一些流行且较常用的连接器,数千个应用和数百万次执行已成功使用这些连接器来处理数据和信息。While Logic Apps offers hundreds of connectors, this article describes the popular and more commonly used connectors that are successfully used by thousands of apps and millions of executions for processing data and information. 若要查找连接器的完整列表以及每个连接器的参考信息(例如触发器、操作和限制),请查看连接器概述下的连接器参考页。To find the full list of connectors and each connector's reference information, such as triggers, actions, and limits, review the connector reference pages under Connectors overview. 另外,请详细了解触发器和操作、逻辑应用定价模型以及逻辑应用定价详细信息。Also, learn more about triggers and actions, Logic Apps pricing model, and Logic Apps pricing details.
提示
若要与没有连接器的服务或 API 集成,可以通过 HTTP 等协议直接调用该服务,或创建自定义连接器。To integrate with a service or API that doesn't have connector, you can either directly call the service over a protocol such as HTTP, or create a custom connector.
连接器类型Connector types
连接器可用作内置触发器和操作,或用作托管的连接器。Connectors are available as built-in triggers and actions or as managed connectors.
内置:内置触发器和操作是 Azure 逻辑应用“原有的”,可帮助你针对逻辑应用执行以下任务:Built-in: Built-in triggers and actions are "native" to Azure Logic Apps and help you perform these tasks for your logic apps:
按自定义计划和高级计划运行。Run on custom and advanced schedules.
组织和控制逻辑应用的工作流(例如循环和条件),以及处理变量和数据操作。Organize and control your logic app's workflow, for example, loops and conditions, and also to work with variables and data operations.
与其他终结点通信。Communicate with other endpoints.
接收和响应请求。Receive and respond to requests.
调用 Azure 函数、Azure API 应用(Web 应用)、通过 Azure API 管理进行管理和发布的自有 API,以及接收请求的嵌套逻辑应用。Call Azure functions, Azure API Apps (Web Apps), your own APIs managed and published with Azure API Management, and nested logic apps that can receive requests.
托管连接器:这些连接器由 Microsoft 部署和管理,提供触发器与操作用于访问云服务和/或本地系统,包括 Office 365、Azure Blob 存储、SQL Server、Dynamics、Salesforce、SharePoint 等等。Managed connectors: Deployed and managed by Microsoft, these connectors provide triggers and actions for accessing cloud services, on-premises systems, or both, including Office 365, Azure Blob Storage, SQL Server, Dynamics, Salesforce, SharePoint, and more. 某些连接器专门支持企业到企业 (B2B) 通信方案,需要一个与逻辑应用链接的集成帐户。Some connectors specifically support business-to-business (B2B) communication scenarios and require an integration account that's linked to your logic app. 在使用某些连接器之前,可能需要先创建由 Azure 逻辑应用管理的连接。Before using certain connectors, you might have to first create connections, which are managed by Azure Logic Apps.
例如,如果你使用 Microsoft BizTalk Server,则逻辑应用可以使用 BizTalk Server 本地连接器连接到 BizTalk Server 并与其通信。For example, if you're using Microsoft BizTalk Server, your logic apps can connect to and communicate with your BizTalk Server by using the BizTalk Server on-premises connector. 然后,可以使用集成帐户连接器在逻辑应用中扩展或执行类似于 BizTalk 的操作。You can then extend or perform BizTalk-like operations in your logic apps by using the integration account connectors.
连接器分类为“标准”或“企业”连接器。Connectors are classified as either Standard or Enterprise. 企业连接器提供对 SAP、IBM MQ 和 IBM 3270 等企业系统的访问,但会产生额外的费用。Enterprise connectors provide access to enterprise systems such as SAP, IBM MQ, and IBM 3270 for an additional cost. 若要确定某个连接器是标准还是企业连接器,请参阅连接器概述下每个连接器的参考页中的技术详细信息。To determine whether a connector is Standard or Enterprise, see the technical details in each connector's reference page under Connectors overview.
也可以使用这些类别来识别连接器,不过,某些连接器可能存在于多个类别中。You can also identify connectors by using these categories, although some connectors can exist in multiple categories. 例如,SAP 既是企业连接器,也是本地连接器:For example, SAP is an Enterprise connector and an on-premises connector:
CategoryCategory 说明Description 托管连接器Managed connectors 创建使用 Azure Blob 存储、Office 365、Dynamics、Power BI、OneDrive、Salesforce、SharePoint Online 等服务的逻辑应用。Create logic apps that use services such as Azure Blob Storage, Office 365, Dynamics, Power BI, OneDrive, Salesforce, SharePoint Online, and many more. 本地连接器On-premises connectors 安装并设置本地数据网关后,这些连接器可以帮助逻辑应用访问 SQL Server、SharePoint Server、Oracle DB、文件共享等本地系统。After you install and set up the on-premises data gateway, these connectors help your logic apps access on-premises systems such as SQL Server, SharePoint Server, Oracle DB, file shares, and others. 集成帐户连接器Integration account connectors 创建和付费购买集成帐户时可以使用这些连接器,它们会转换和验证 XML、编码和解码平面文件,以及使用 AS2、EDIFACT 和 X12 协议处理企业到企业 (B2B) 消息。Available when you create and pay for an integration account, these connectors transform and validate XML, encode and decode flat files, and process business-to-business (B2B) messages with AS2, EDIFACT, and X12 protocols.
内置Built-in
逻辑应用提供内置触发器和操作,使你能够创建基于计划的工作流、帮助逻辑应用与其他应用和服务通信、通过逻辑应用控制工作流,以及管理或处理数据。Logic Apps provides built-in triggers and actions so that you can create schedule-based workflows, help your logic apps communicate with other apps and services, control the workflow through your logic apps, and manage or manipulate data.
名称Name | 说明Description |
---|---|
![]() 计划 ![]() Schedule |
- 使用 “重复周期” 触发器,按指定的重复周期以简单到高级的计划运行逻辑应用。- Run a logic app on a specified recurrence, ranging from basic to advanced schedules with the Recurrence trigger. - 使用 “滑动窗口” 触发器,运行需要处理连续区块中的数据的逻辑应用。- Run a logic app that needs to handle data in continuous chunks with the Sliding Window trigger. - 使用 “延迟” 操作,将逻辑应用暂停指定的持续时间。- Pause your logic app for a specified duration with the Delay action. - 使用 “延迟截止时间” 操作,将逻辑应用暂停到指定的日期和时间。- Pause your logic app until the specified date and time with the Delay until action. |
![]() 批处理 ![]() Batch |
- 使用“批处理消息”触发器来批量处理消息。- Process messages in batches with the Batch messages trigger. - 使用“发送要批量处理的消息”操作调用具有现有批处理触发器的逻辑应用。- Call logic apps that have existing batch triggers with the Send messages to batch action. |
![]() HTTP ![]() HTTP |
使用适用于 HTTP 的触发器和操作调用 HTTP 或 HTTPS 终结点。Call HTTP or HTTPS endpoints with triggers and actions for HTTP. 其他 HTTP 内置触发器和操作包括 HTTP + Swagger 内置连接器和 HTTP + Webhook。Other HTTP built-in triggers and actions include HTTP + Swagger built-in connector and HTTP + Webhook. |
![]() 请求 ![]() Request |
- 使用“请求”触发器,使逻辑应用可从其他应用程序或服务调用、针对事件网格资源事件触发,或者针对 Azure 安全中心警报触发。- Make your logic app callable from other apps or services, trigger on Event Grid resource events, or trigger on responses to Azure Security Center alerts with the Request trigger. - 使用“响应”操作将响应发送到应用或服务。- Send responses to an app or service with the Response action. |
![]() Azure API 管理 ![]() Azure API Management |
调用可以使用 Azure API 管理进行管理和发布的自有 API 定义的触发器与操作。Call triggers and actions defined by your own APIs that you manage and publish with Azure API Management. |
![]() Azure 应用 服务 ![]() Azure App Services |
调用 Azure 应用服务上托管的 Azure API 应用或 Web 应用。Call Azure API Apps, or Web Apps, hosted on Azure App Service. 包含 Swagger 后,这些应用定义的触发器和操作类似于其他任何第一类触发器和操作。The triggers and actions defined by these apps appear like any other first-class triggers and actions when Swagger is included. |
![]() Azure 逻辑 应用 ![]() Azure Logic Apps |
调用使用“请求”触发器启动的其他逻辑应用。Call other logic apps that start with the Request trigger. |
从逻辑应用运行代码Run code from logic apps
逻辑应用提供内置操作用于在逻辑应用工作流中运行你自己的代码:Logic Apps provides built-in actions for running your own code in your logic app's workflow:
名称Name | 说明Description |
---|---|
![]() Azure Functions ![]() Azure Functions |
从逻辑应用调用运行自定义代码片段(C# 或 Node.js)的 Azure 函数。Call Azure functions that run custom code snippets (C# or Node.js) from your logic apps. |
控制工作流Control workflow
逻辑应用提供用于在逻辑应用工作流中构建和控制操作的内置操作:Logic Apps provides built-in actions for structuring and controlling the actions in your logic app's workflow:
名称Name | 说明Description |
---|---|
![]() 条件 ![]() Condition |
评估条件,并根据条件是 true 还是 false 运行不同的操作。Evaluate a condition and run different actions based on whether the condition is true or false. |
![]() 全部应用 ![]() For each |
对数组中的每个项执行相同的操作。Perform the same actions on every item in an array. |
[![]() ![]() 范围][scope-doc]Scope][scope-doc] |
将操作分组到范围,以便在该范围内的操作完成运行后,获取这些操作的自身状态。Group actions into scopes, which get their own status after the actions in the scope finish running. |
![]() 切换 ![]() Switch |
将操作分组到案例,而案例分配有唯一的值(默认案例除外)。Group actions into cases, which are assigned unique values except for the default case. 仅运行其分配值与表达式、对象或令牌的结果相匹配的案例。Run only that case whose assigned value matches the result from an expression, object, or token. 如果不存在任何匹配项,则运行默认案例。If no matches exist, run the default case. |
![]() 终止 ![]() Terminate |
停止当前正在运行的逻辑应用工作流。Stop an actively running logic app workflow. |
![]() 截止 ![]() Until |
重复操作,直到指定的条件为 true 或某个状态发生更改。Repeat actions until the specified condition is true or some state has changed. |
管理或处理数据Manage or manipulate data
逻辑应用提供用于处理数据输出及其格式的内置操作:Logic Apps provides built-in actions for working with data outputs and their formats:
名称Name | 说明Description |
---|---|
![]() 数据操作 ![]() Data Operations |
对数据执行操作:Perform operations with data: - 撰写:基于具有不同类型的多个输入创建单个输出。- Compose: Create a single output from multiple inputs with various types. |
![]() ![]() 日期时间Date Time |
对时间戳执行操作:Perform operations with timestamps: - 添加到时间:将指定的单位数添加到时间戳。- Add to time: Add the specified number of units to a timestamp. |
![]() 变量 ![]() Variables |
对变量执行操作:Perform operations with variables: - 追加到数组变量:插入一个值,作为变量存储的数组中的最后一个项。- Append to array variable: Insert a value as the last item in an array stored by a variable. |
托管的连接器Managed connectors
逻辑应用提供以下用于自动化这些服务或系统的任务、流程和工作流的流行标准连接器:Logic Apps provides these popular Standard connectors for automating tasks, processes, and workflows with these services or systems:
名称Name | 说明Description |
---|---|
![]() Azure 服务总线 ![]() Azure Service Bus |
使用逻辑应用中最常用的连接器管理异步消息、会话和主题订阅。Manage asynchronous messages, sessions, and topic subscriptions with the most commonly used connector in Logic Apps. |
![]() SQL Server ![]() SQL Server |
连接到本地 SQL Server 或云中的 Azure SQL 数据库,以便可以管理记录、运行存储过程或执行查询。Connect to your SQL Server on premises or an Azure SQL Database in the cloud so that you can manage records, run stored procedures, or perform queries. |
![]() Azure Blob 存储 ![]() Azure Blob Storage |
连接到存储帐户,以便可以创建和管理 Blob 内容。Connect to your storage account so that you can create and manage blob content. |
![]() Office 365 Outlook ![]() Office 365 Outlook |
连接到工作或学校电子邮件帐户,以便可以创建和管理电子邮件、任务、日历事件和会议、联系人、请求,等等。Connect to your work or school email account so that you can create and manage emails, tasks, calendar events and meetings, contacts, requests, and more. |
![]() SFTP-SSH ![]() SFTP-SSH |
使用 SSH 连接到可从 Internet 访问的 SFTP 服务器,以便可以处理文件和文件夹。Connect to SFTP servers that you can access from the internet by using SSH so that you can work with your files and folders. |
![]() SharePoint Online ![]() SharePoint Online |
连接到 SharePoint Online,以便可以管理文件、附件、文件夹,等等。Connect to SharePoint Online so that you can manage files, attachments, folders, and more. |
![]() Azure 队列 ![]() Azure Queues |
连接到 Azure 存储帐户,以便创建和管理队列与消息。Connect to your Azure Storage account so that you can create and manage queues and messages. |
![]() FTP ![]() FTP |
连接到可从 Internet 访问的 FTP 服务器,以便可以处理文件和文件夹。Connect to FTP servers you can access from the internet so that you can work with your files and folders. |
![]() Azure 事件中心 ![]() Azure Event Hubs |
通过事件中心使用和发布事件。Consume and publish events through an Event Hub. 例如,通过事件中心获取逻辑应用的输出,然后将输出发送到实时分析提供程序。For example, get output from your logic app with Event Hubs, and then send that output to a real-time analytics provider. |
![]() Salesforce ![]() Salesforce |
连接到 Salesforce 帐户,以便可以创建和管理记录、作业、对象,等等。Connect to your Salesforce account so that you can create and manage items such as records, jobs, objects, and more. |
本地连接器On-premises connectors
在创建与本地系统的连接之前,必须先下载、安装并设置本地数据网关。Before you can create a connection to an on-premises system, you must first download, install, and set up an on-premises data gateway. 此网关提供安全信道,无需设置所需的网络基础结构。This gateway provides a secure communication channel without having to set up the necessary network infrastructure.
逻辑应用提供了下面这些常用的标准连接器,用于访问本地系统中的数据和资源。Here are some commonly used Standard connectors that Logic Apps provides for accessing data and resources in on-premises systems. 对于本地连接器列表,请参阅支持的数据源。For the on-premises connectors list, see Supported data sources.
集成帐户连接器Integration account connectors
逻辑应用提供标准连接器,用于在创建和付费购买集成帐户(通过 Azure 中的 Enterprise Integration Pack (EIP) 提供)时,在逻辑应用中生成企业到企业 (B2B) 解决方案。Logic Apps provides Standard connectors for building business-to-business (B2B) solutions with your logic apps when you create and pay for an integration account, which is available through the Enterprise Integration Pack (EIP) in Azure. 使用此帐户可以创建和存储 B2B 项目,例如贸易合作伙伴、协议、映射、架构、证书,等等。With this account, you can create and store B2B artifacts such as trading partners, agreements, maps, schemas, certificates, and so on. 若要使用这些项目,请将逻辑应用与集成帐户相关联。To use these artifacts, associate your logic apps with your integration account. 如果你当前使用的是 BizTalk Server,则可能已熟悉这些连接器的用法。If you currently use BizTalk Server, these connectors might seem familiar already.
企业连接器Enterprise connectors
逻辑应用提供以下用于访问 SAP 和 IBM MQ 等企业系统的企业连接器:Logic Apps provides these Enterprise connectors for accessing enterprise systems, such as SAP and IBM MQ:
触发器和操作类型Triggers and action types
连接器可以提供触发器和/或操作。 Connectors can provide triggers, actions, or both. 触发器是任何逻辑应用中的第一个步骤,它通常指定激发触发器并开始运行逻辑应用的事件。A trigger is the first step in any logic app, usually specifying the event that fires the trigger and starts running your logic app. 例如,FTP 连接器中的某个触发器会在“添加或修改某个文件时”启动逻辑应用。For example, the FTP connector has a trigger that starts your logic app "when a file is added or modified". 某些触发器定期检查指定的事件或数据,并在检测到指定的事件或数据时激发。Some triggers regularly check for the specified event or data and then fire when they detect the specified event or data. 其他触发器会保持等待状态,但一旦发生特定的事件或者有新的数据可用,就会立即激发。Other triggers wait but fire instantly when a specific event happens or when new data is available. 触发器还会将任何所需数据传递给逻辑应用。Triggers also pass along any required data to your logic app. 在整个工作流中,逻辑应用都可以读取和使用该数据。Your logic app can read and use that data throughout the workflow. 例如,Office 365 Outlook 连接器包含一个触发器“新电子邮件到达时”,该触发器可以将内容从电子邮件传递到逻辑应用的工作流中。For example, the Office 365 Outlook connector has a trigger, "When a new email arrives", that can pass the content from that email into your logic app's workflow.
触发器激发后,Azure 逻辑应用将创建逻辑应用的实例,并开始运行逻辑应用工作流中的操作。After a trigger fires, Azure Logic Apps creates an instance of your logic app and starts running the actions in your logic app's workflow. 操作是激发触发器后的步骤,将执行逻辑应用工作流中的任务。Actions are the steps that follow the trigger and perform tasks in your logic app's workflow. 例如,可以创建一个逻辑应用来获取 SQL 数据库中的客户数据,并在后续的操作中处理该数据。For example, you can create a logic app that gets customer data from a SQL database and process that data in later actions.
下面是 Azure 逻辑应用提供的常规类型的触发器:Here are the general kinds of triggers that Azure Logic Apps provides:
重复周期触发器:此触发器按指定的计划运行,不与特定的服务或系统密切相关。Recurrence trigger: This trigger runs on a specified schedule and isn't tightly associated with a particular service or system.
轮询触发器:此触发器根据指定的计划定期轮询特定的服务或系统,检查是否有可用的新数据或者是否发生了特定的事件。Polling trigger: This trigger regularly polls a specific service or system based on the specified schedule, checking for new data or whether a specific event happened. 如果有可用的新数据或者发生了特定的事件,该触发器将创建并运行逻辑应用的新实例,该实例现在可以使用作为输入传递的数据。If new data is available or the specific event happened, the trigger creates and runs a new instance of your logic app, which can now use the data that's passed as input.
推送触发器:此触发器等待并侦听新数据或事件的发生。Push trigger: This trigger waits and listens for new data or for an event to happen. 如果有可用的新数据或者发生了该事件,该触发器将创建并运行逻辑应用的新实例,该实例现在可以使用作为输入传递的数据。When new data is available or when the event happens, the trigger creates and runs new instance of your logic app, which can now use the data that's passed as input.
连接器配置Connector configuration
每个连接器的触发器和操作提供其自身的属性,你可以配置这些属性。Each connector's triggers and actions provide their own properties for you to configure. 许多连接器还要求先与目标服务或系统建立连接,并提供身份验证凭据或其他配置详细信息,然后,你才能在逻辑应用中使用某个触发器或操作。Many connectors also require that you first create a connection to the target service or system and provide authentication credentials or other configuration details before you can use a trigger or action in your logic app. 例如,在可以访问和使用 Office 365 Outlook 电子邮件帐户之前,你必须为与该帐户的连接授权。For example, before you can access and working with your Office 365 Outlook email account, you must authorize a connection to that account.
对于使用 Azure Active Directory (Azure AD) OAuth 的连接器,创建连接意味着要登录到服务(例如 Office 365、Salesforce 或 GitHub),其中的访问令牌已加密并安全存储在 Azure 机密存储中。For connectors that use Azure Active Directory (Azure AD) OAuth, creating a connection means signing into the service, such as Office 365, Salesforce, or GitHub, where your access token is encrypted and securely stored in an Azure secret store. 其他连接器(例如 FTP 和 SQL)需要提供包含服务器地址、用户名和密码等配置详细信息的连接。Other connectors, such as FTP and SQL, require a connection that has configuration details, such as the server address, username, and password. 这些连接配置详细信息同样加密并安全存储。These connection configuration details are also encrypted and securely stored. 详细了解 Azure 中的加密。Learn more about encryption in Azure.
只要目标服务或系统允许,连接就可以访问该服务或系统。Connections can access the target service or system for as long as that service or system allows. 对于使用 Azure AD OAuth 连接的服务(例如 Office 365 和 Dynamics),Azure 逻辑应用会无限期地刷新访问令牌。For services that use Azure AD OAuth connections, such as Office 365 and Dynamics, Azure Logic Apps refreshes access tokens indefinitely. 其他服务可能会限制在不刷新令牌的情况下,Azure 逻辑应用能够使用该令牌多长时间。Other services might have limits on how long Azure Logic Apps can use a token without refreshing. 一般情况下,某些操作(例如更改密码)会使所有访问令牌失效。Generally, some actions invalidate all access tokens, such as changing your password.
自定义 API 和连接器Custom APIs and connectors
若要调用运行自定义代码或者无法作为连接器使用的 API,可以通过创建自定义 API 应用来扩展逻辑应用平台。To call APIs that run custom code or aren't available as connectors, you can extend the Logic Apps platform by creating custom API Apps. 还可以针对任何基于 REST 或 SOAP 的 API 创建自定义连接器,使这些 API 可供 Azure 订阅中的任何逻辑应用使用。You can also create custom connectors for any REST or SOAP-based APIs, which make those APIs available to any logic app in your Azure subscription. 若要使自定义 API 应用或连接器可供任何人在 Azure 中使用,可以提交连接器进行 Microsoft 认证。To make custom API Apps or connectors public for anyone to use in Azure, you can submit connectors for Microsoft certification.
阻止创建连接Block creating connections
如果组织不允许使用 Azure 逻辑应用中的连接器连接到特定资源,则可以在逻辑应用工作流中使用 Azure Policy 阻止为特定连接器创建这些连接的功能。If your organization doesn't permit connecting to specific resources by using their connectors in Azure Logic Apps, you can block the capability to create those connections for specific connectors in logic app workflows by using Azure Policy. 有关详细信息,请参阅在 Azure 逻辑应用中阻止特定连接器创建的连接。For more information, see Block connections created by specific connectors in Azure Logic Apps.
准备部署Get ready for deployment
尽管从逻辑应用中创建连接,但连接是具有自己的资源定义的单独 Azure 资源。Although you create connections from within a logic app, connections are separate Azure resources with their own resource definitions. 若要查看这些连接资源定义,请将逻辑应用从 Azure 下载到 Visual Studio 中,这是创建最适用部署的有效参数化逻辑应用模板的最简单方法。To review these connection resource definitions, download your logic app from Azure into Visual Studio, which is the easiest way to create a valid parameterized logic app template that's mostly ready for deployment.