適用於 Azure Logic Apps 的連接器Connectors for Azure Logic Apps

在 Azure Logic Apps 中, 連接器 可協助您快速存取來自其他應用程式、服務、系統、通訊協定和平臺的資料、事件和其他資源。In Azure Logic Apps, connectors help you quickly access data, events, and other resources from other apps, services, systems, protocols, and platforms. 當您使用連接器時,可以建立邏輯應用程式工作流程,以在雲端式、內部部署和混合式環境中使用、處理和整合資訊,通常不需要撰寫任何程式碼。When you use connectors, you can build logic app workflows that use, process, and integrate information across cloud-based, on-premises, and hybrid environments - often without having to write any code.

您可以從數百個連接器中進行選擇,以在您的工作流程中使用。You can choose from hundreds of connectors to use in your workflows. 因此,本檔著重于 Logic Apps 的一些常用且常用的連接器。As a result, this documentation focuses on some popular and commonly used connectors for Logic Apps. 如需有關跨 Logic Apps、Microsoft Power Automate 和 Microsoft Power Apps 之連接器的完整資訊,請參閱 連接器檔For complete information about connectors across Logic Apps, Microsoft Power Automate, and Microsoft Power Apps, review the Connectors documentation. 如需定價的詳細資訊,請參閱 Logic Apps 計價模式,並 Logic Apps 定價詳細資料For information on pricing, review the Logic Apps pricing model, and Logic Apps pricing details.

注意

若要整合您的工作流程與沒有連接器的服務或 API,您可以透過通訊協定(例如 HTTP)呼叫服務,或 建立自訂連接器To integrate your workflow with a service or API that doesn't have a connector, you can either call the service over a protocol, such as HTTP, or create a custom connector.

什麼是連接器?What are connectors?

連接器會提供 觸發 程式和 動作 ,讓您用來在邏輯應用程式的工作流程中執行工作。Connectors provide triggers and actions that you use to perform tasks in your logic app's workflow. 每個觸發程式和動作都有您可以設定的屬性。Each trigger and action has properties that you can configure. 某些觸發程式和動作需要您 建立和設定 連線,讓您的工作流程可以存取特定的服務或系統。Some triggers and actions require that you create and configure connections so that your workflow can access a specific service or system.

觸發程序Triggers

觸發 程式會指定啟動工作流程的事件,而且一律為任何工作流程中的第一個步驟。A trigger specifies the event that starts the workflow and is always the first step in any workflow. 每個觸發程式也會遵循特定的引發模式,以控制觸發程式監視及回應事件的方式。Each trigger also follows a specific firing pattern that controls how the trigger monitors and responds to events. 觸發程式通常會遵循 輪詢 模式或 推入 模式,但有時可以在這兩個版本中使用觸發程式。Usually, a trigger follows the polling pattern or push pattern, but sometimes, a trigger is available in both versions.

  • 輪詢觸發 程式會定期檢查特定的服務或系統是否有指定的排程,以檢查新的資料或特定的事件。Polling triggers regularly check a specific service or system on a specified schedule to check for new data or a specific event. 如果有新的資料可供使用,或發生特定事件,這些觸發程式就會建立並執行新的工作流程實例。If new data is available, or the specific event happens, these triggers create and run a new instance of your workflow. 這個新的實例接著可以使用傳遞做為輸入的資料。This new instance can then use the data that's passed as input.
  • 推送觸發 程式會接聽新資料或發生事件,而不進行輪詢。Push triggers listen for new data or for an event to happen, without polling. 當有新資料可用或發生事件時,這些觸發程式就會建立並執行新的工作流程實例。When new data is available, or when the event happens, these triggers create and run a new instance of your workflow. 這個新的實例接著可以使用傳遞做為輸入的資料。This new instance can then use the data that's passed as input.

例如,您可能想要建立一個工作流程,以在檔案上傳至您的 FTP 伺服器時執行某些工作。For example, you might want to build a workflow that does something when a file is uploaded to your FTP server. 在工作流程的第一個步驟中,您可以使用在 新增或修改檔案時 所命名的 FTP 觸發程式,這會遵循輪詢模式。As the first step in your workflow, you can use the FTP trigger named When a file is added or modified, which follows the polling pattern. 然後,您可以指定排程定期檢查上傳事件。You can then specify a schedule to regularly check for upload events.

觸發程式也會將任何輸入和其他必要的資料傳遞至您的工作流程中,之後的動作可以在整個工作流程中參考及使用該資料。A trigger also passes along any inputs and other required data into your workflow where later actions can reference and use that data throughout the workflow. 例如,假設您想要在收到新電子郵件時,使用 新的電子郵件送達時 ,使用名為的 Office 365 Outlook 觸發程式來啟動工作流程。For example, suppose you want to use Office 365 Outlook trigger named When a new email arrives to start a workflow when you get a new email. 您可以設定此觸發程式,以從每個新的電子郵件傳遞內容,例如寄件者、主旨行、主體、附件等。You can configure this trigger to pass along the content from each new email, such as the sender, subject line, body, attachments, and so on. 然後,您的工作流程就可以使用其他動作來處理該資訊。Your workflow can then process that information by using other actions.

動作Actions

動作 是在觸發程式之後執行的作業,並在您的工作流程中執行某種類型的工作。An action is an operation that follows the trigger and performs some kind of task in your workflow. 您可以在工作流程中使用多個動作。You can use multiple actions in your workflow. 例如,您可以使用在 SQL database 中偵測到新客戶資料的 SQL 觸發程式來啟動工作流程。For example, you might start the workflow with a SQL trigger that detects new customer data in a SQL database. 在觸發程式之後,您的工作流程可以有取得客戶資料的 SQL 動作。Following the trigger, your workflow can have a SQL action that gets the customer data. 在 SQL 動作之後,您的工作流程可以有另一個動作,而不是 SQL,可處理資料。Following the SQL action, your workflow can have another action, not necessarily SQL, that processes the data.

連接器類別Connector categories

在 Logic Apps 中,大部分的觸發程式和動作都可以在內 版本或 受控連接器 版本中使用。In Logic Apps, most triggers and actions are available in either a built-in version or managed connector version. 這兩個版本都有少量的觸發程式和動作可供使用。A small number of triggers and actions are available in both versions. 可用的版本取決於您是建立多租使用者邏輯應用程式或單一租使用者邏輯應用程式,此應用程式目前只在 Logic Apps 預覽版中提供。The versions available depend on whether you create a multi-tenant logic app or a single-tenant logic app, which is currently available only in Logic Apps Preview.

內建的觸發程式和動作 會以原生方式在 Logic Apps 執行時間上執行,不需要建立連線,並執行下列類型的工作:Built-in triggers and actions run natively on the Logic Apps runtime, don't require creating connections, and perform these kinds of tasks:

受管理的連接器 是由 Microsoft 所部署、託管和管理。Managed connectors are deployed, hosted, and managed by Microsoft. 這些連接器會為雲端服務、內部部署系統或兩者提供觸發程式和動作。These connectors provide triggers and actions for cloud services, on-premises systems, or both. 受控連接器可在下列類別中使用:Managed connectors are available in these categories:

連線設定Connection configuration

大部分的連接器都需要您先建立目標服務或 系統的連線,才能 在您的工作流程中使用其觸發程式或動作。Most connectors require that you first create a connection to the target service or system before you can use its triggers or actions in your workflow. 若要建立連線,您必須使用帳號憑證(有時是其他連接資訊)來驗證您的身分識別。To create a connection, you have to authenticate your identity with account credentials and sometimes other connection information. 例如,在您的工作流程可以存取並使用 Office 365 Outlook 電子郵件帳戶之前,您必須授權該帳戶的連線。For example, before your workflow can access and work with your Office 365 Outlook email account, you must authorize a connection to that account.

連接安全性和加密Connection security and encryption

針對使用 Azure Active Directory (Azure AD) OAuth (例如 Office 365、Salesforce 或 GitHub)的連接器,您必須登入已 加密 存取權杖的服務,並將其安全地儲存在 Azure 秘密中。For connectors that use Azure Active Directory (Azure AD) OAuth, such as Office 365, Salesforce, or GitHub, you must sign into the service where your access token is encrypted and securely stored in an Azure secret. 其他連接器(例如 FTP 和 SQL)需要具有設定詳細資料的連接,例如伺服器位址、使用者名稱和密碼。Other connectors, such as FTP and SQL, require a connection that has configuration details, such as the server address, username, and password. 這些連線設定詳細資料也會 加密並安全地儲存在 Azure 中These connection configuration details are also encrypted and securely stored in Azure.

只要服務或系統允許,已建立的連接就可以存取目標服務或系統。Established connections can access the target service or system for as long as that service or system allows. 針對使用 Azure AD OAuth 連接的服務(例如 Office 365 和 Dynamics),Logic Apps 服務會無限期地重新整理存取權杖。For services that use Azure AD OAuth connections, such as Office 365 and Dynamics, the Logic Apps service refreshes access tokens indefinitely. 其他服務可能會限制 Logic Apps 可使用權杖的時間長度,而不需要重新整理。Other services might have limits on how long Logic Apps can use a token without refreshing. 某些動作(例如變更您的密碼)會使所有存取權杖失效。Some actions, such as changing your password, invalidate all access tokens.

雖然您會從工作流程內建立連線,但連線是個別的 Azure 資源與其本身的資源定義。Although you create connections from within a workflow, connections are separate Azure resources with their own resource definitions. 若要檢查這些連線資源定義,請將 邏輯應用程式從 Azure 下載至 Visual StudioTo review these connection resource definitions, download your logic app from Azure into Visual Studio. 這個方法是建立一個最簡單的參數化邏輯應用程式範本的最簡單方式,該範本幾乎可供部署。This method is the easiest way to create a valid, parameterized logic app template that's mostly ready for deployment.

提示

如果您的組織不允許您透過 Logic Apps 連接器來存取特定資源,您可以使用Azure 原則來封鎖建立這類連線的功能If your organization doesn't permit you to access specific resources through Logic Apps connectors, you can block the capability to create such connections using Azure Policy.

連接的防火牆存取Firewall access for connections

如果您使用防火牆來限制流量,且邏輯應用程式工作流程需要透過該防火牆進行通訊,您必須設定防火牆,以允許在邏輯應用程式工作流程所在的 Azure 區域中,Logic Apps 服務或執行時間所使用的 輸入輸出 IP 位址。If you use a firewall that limits traffic, and your logic app workflows need to communicate through that firewall, you have to set up your firewall to allow access for both the inbound and outbound IP addresses used by the Logic Apps service or runtime in the Azure region where your logic app workflows exist. 如果您的工作流程也使用受管理的連接器,例如 Office 365 Outlook connector 或 SQL connector,或使用自訂連接器,則您的防火牆也需要允許邏輯應用程式的 Azure 區域中 所有受管理連接器輸出 IP 位址的存取權。If your workflows also use managed connectors, such as the Office 365 Outlook connector or SQL connector, or use custom connectors, your firewall also needs to allow access for all the managed connector outbound IP addresses in your logic app's Azure region. 如需詳細資訊,請參閱 防火牆設定。For more information, review Firewall configuration.

週期行為Recurrence behavior

週期性的內建觸發程式(例如 迴圈觸發程式)會在 Logic Apps 執行時間上以原生方式執行,與週期性的連接式觸發程式不同,例如,您需要先建立連接的 Office 365 Outlook 連接器觸發程式。Recurring built-in triggers, such as the Recurrence trigger, run natively on the Logic Apps runtime and differ from recurring connection-based triggers, such as the Office 365 Outlook connector trigger where you need to create a connection first.

對於這兩種觸發程式而言,如果迴圈未指定特定的開始日期和時間,則當您儲存或部署邏輯應用程式時,會立即執行第一個週期,儘管您的觸發程式的迴圈設定是如此。For both kinds of triggers, if a recurrence doesn't specify a specific start date and time, the first recurrence runs immediately when you save or deploy the logic app, despite your trigger's recurrence setup. 若要避免此行為,請提供您想要執行第一個週期的開始日期和時間。To avoid this behavior, provide a start date and time for when you want the first recurrence to run.

內建觸發程式的週期Recurrence for built-in triggers

週期性的內建觸發程式會遵循您所設定的排程,包括任何指定的時區。Recurring built-in triggers follow the schedule that you set, including any specified time zone. 但是,如果週期未指定其他的高階排程選項(例如執行未來週期的特定時間),則會根據最後一個觸發程式執行來執行這些週期。However, if a recurrence doesn't specify other advanced scheduling options, such as specific times to run future recurrences, those recurrences are based on the last trigger execution. 如此一來,這些週期的開始時間可能會因為像是儲存體呼叫期間的延遲等因素而漂移。As a result, the start times for those recurrences might drift due to factors such as latency during storage calls.

如需詳細資訊,請參閱下列檔:For more information, review the following documentation:

以連接為基礎之觸發程式的週期Recurrence for connection-based triggers

在週期性的連接式觸發程式中(例如 Office 365 Outlook),此排程不是控制執行的唯一驅動程式。In recurring connection-based triggers, such as Office 365 Outlook, the schedule isn't the only driver that controls execution. 時區只會決定初始開始時間。The time zone only determines the initial start time. 後續的執行取決於週期排程、最後一個觸發程式執行,以及可能造成執行時間漂移或產生非預期行為的其他因素,例如:Subsequent runs depend on the recurrence schedule, the last trigger execution, and other factors that might cause run times to drift or produce unexpected behavior, for example:

  • 觸發程式是否存取有更多資料的伺服器,而該觸發程式會立即嘗試提取。Whether the trigger accesses a server that has more data, which the trigger immediately tries to fetch.
  • 觸發程式產生的任何失敗或重試。Any failures or retries that the trigger incurs.
  • 儲存體呼叫期間的延遲。Latency during storage calls.
  • 當日光節約時間 (DST) 開始和結束時,不會維持指定的排程。Not maintaining the specified schedule when daylight saving time (DST) starts and ends.
  • 下次執行時間發生時可能會影響的其他因素。Other factors that can affect when the next run time happens.

如需詳細資訊,請參閱下列檔:For more information, review the following documentation:

針對迴圈問題進行疑難排解Troubleshooting recurrence issues

為了確保您的工作流程會在指定的開始時間執行而不會錯過迴圈,特別是當頻率是以天或更長的時間執行時,請嘗試下列解決方案:To make sure that your workflow runs at your specified start time and doesn't miss a recurrence, especially when the frequency is in days or longer, try the following solutions:

  • 當 DST 生效時,請手動調整週期,讓您的工作流程在預期的時間繼續執行。When DST takes effect, manually adjust the recurrence so that your workflow continues to run at the expected time. 否則,開始時間會在 DST 開始時向前移動一小時,而當 DST 結束時,則會向後移動一小時。Otherwise, the start time shifts one hour forward when DST starts and one hour backward when DST ends. 如需詳細資訊和範例,請參閱 日光節約時間和標準時間的週期For more information and examples, review Recurrence for daylight saving time and standard time.

  • 如果您使用 迴圈 觸發程式,請指定時區、開始日期和時間。If you're using a Recurrence trigger, specify a time zone, a start date and time. 此外,您也可以設定特定時間,在 這些時間 執行屬性中的後續週期,並在 這幾分鐘內 執行,這只適用于 DayWeek 的頻率。In addition, configure specific times to run subsequent recurrences in the properties At these hours and At these minutes, which are available only for the Day and Week frequencies. 不過,當時間改變時,windows 可能仍會造成問題。However, some time windows might still cause problems when the time shifts.

  • 請考慮使用 滑動視窗 觸發 程式,而非 週期性觸發程式 ,以避免遺失的週期。Consider using a Sliding Window trigger instead of a Recurrence trigger to avoid missed recurrences.

自訂 API 和連接器Custom APIs and connectors

若要呼叫可執行自訂程式碼或不可作為連接器的 API,您可建立自訂 API Apps,以擴充 Logic Apps 平台。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 Apps 或連接器以使用於 Azure,您可以提交連接器進行 Microsoft 認證To make custom API Apps or connectors public for anyone to use in Azure, you can submit connectors for Microsoft certification.

ISE 和連接器ISE and connectors

對於需要直接存取 Azure 虛擬網路中的資源的工作流程,您可以建立專用的 整合服務環境 (ISE) ,您可以在其中建立、部署和執行您在專用資源上的工作流程。For workflows that need direct access to resources in an Azure virtual network, you can create a dedicated integration service environment (ISE) where you can build, deploy, and run your workflows on dedicated resources. 如需有關建立 Ise 的詳細資訊,請參閱 從 Azure Logic Apps 連線到 Azure 虛擬網路For more information about creating ISEs, review Connect to Azure virtual networks from Azure Logic Apps.

在 ISE 內建立的自訂連接器無法與內部部署資料閘道搭配使用。Custom connectors created within an ISE don't work with the on-premises data gateway. 不過,這些連接器可以直接存取連線到裝載 ISE 之 Azure 虛擬網路的內部部署資料來源。However, these connectors can directly access on-premises data sources that are connected to an Azure virtual network hosting the ISE. 因此,ISE 中的邏輯應用程式在與這些資源進行通訊時,最可能不需要資料閘道。So, logic apps in an ISE most likely don't need the data gateway when communicating with those resources. 如果您有在需要內部部署資料閘道的 ISE 之外建立的自訂連接器,ISE 中的邏輯應用程式可以使用這些連接器。If you have custom connectors that you created outside an ISE that require the on-premises data gateway, logic apps in an ISE can use those connectors.

在 Logic Apps 設計工具中,當您在 ISE 中流覽要用於邏輯應用程式的內建觸發程式和動作或受控連接器時, 核心 標籤會出現在內建的觸發程式和動作中,而 ISE 標籤會出現在專門設計來與 ISE 搭配運作的受控連接器上。In the Logic Apps Designer, when you browse the built-in triggers and actions or managed connectors that you want to use for logic apps in an ISE, the CORE label appears on built-in triggers and actions, while the ISE label appears on managed connectors that are specifically designed to work with an ISE.

核心連接器範例 </span>Example CORE connector </span>
核心 </span>CORE </span>
使用此標籤的內建觸發程式和動作會在與邏輯應用程式相同的 ISE 中執行。Built-in triggers and actions with this label run in the same ISE as your logic apps.

ISE 連接器範例 </span>Example ISE connector </span>
Ise </span>ISE </span>
具有此標籤的受控連接器會在與邏輯應用程式相同的 ISE 中執行。Managed connectors with this label run in the same ISE as your logic apps.

如果您有連線到 Azure 虛擬網路的內部部署系統,ISE 可讓您的工作流程直接存取該系統,而不需要使用內部 部署資料閘道If you have an on-premises system that's connected to an Azure virtual network, an ISE lets your workflows directly access that system without using the on-premises data gateway. 相反地,您可以使用該系統的 ISE 連接器(如果有的話)、HTTP 動作或 自訂連接器Instead, you can either use that system's ISE connector if available, an HTTP action, or a custom connector.

針對沒有 ISE 連接器的內部部署系統,請使用內部部署資料閘道。For on-premises systems that don't have ISE connectors, use the on-premises data gateway. 若要尋找可用的 ISE 連接器,請參閱 ise 連接器To find available ISE connectors, review ISE connectors.

範例非 ISE 連接器 </span>Example non-ISE connector </span>
沒有標籤 No label

所有其他沒有標籤的連接器,您可以繼續使用這些連接器,在全域、多租使用者 Logic Apps 服務中執行。All other connectors without a label, which you can continue to use, run in the global, multi-tenant Logic Apps service.

已知問題Known issues

下表包含 Logic Apps 連接器的已知問題。The following table includes known issues for Logic Apps connectors.

錯誤訊息Error message DescriptionDescription 解決方案Resolution
Error: BadGateway. Client request id: '{GUID}' 此錯誤的結果是更新邏輯應用程式上的標記,其中一或多個連線不支援 Azure Active Directory (Azure AD) OAuth 驗證(例如 SFTP AD SQL)中斷這些連接。This error results from updating the tags on a logic app where one or more connections don't support Azure Active Directory (Azure AD) OAuth authentication, such as SFTP ad SQL, breaking those connections. 若要避免此行為,請避免更新這些標記。To prevent this behavior, avoid updating those tags.

下一步Next steps