从 Azure 逻辑应用连接到本地数据源Connect to on-premises data sources from Azure Logic Apps

在本地计算机上安装本地数据网关之后,需创建 Azure 资源,然后才能从逻辑应用访问本地数据源。Before you can access data sources on premises from your logic apps, you need to create an Azure resource after you install the on-premises data gateway on a local computer. 逻辑应用然后在用于 Azure 逻辑应用的本地连接器提供的触发器和操作中使用该 Azure 网关资源。Your logic apps then use this Azure gateway resource in the triggers and actions provided by the on-premises connectors that are available for Azure Logic Apps.

本文介绍如何为以前安装在本地计算机上的网关创建 Azure 网关资源。This article shows how to create your Azure gateway resource for a previously installed gateway on your local computer. 有关网关的详细信息,请参阅网关的工作原理For more information about the gateway, see How the gateway works.

有关如何将网关用于其他服务的信息,请参阅以下文章:For information about how to use the gateway with other services, see these articles:

支持的数据源Supported data sources

在 Azure 逻辑应用中,本地数据网关支持以下数据源的本地连接器In Azure Logic Apps, the on-premises data gateway supports the on-premises connectors for these data sources:

  • BizTalk Server 2016BizTalk Server 2016
  • 文件系统File System
  • IBM DB2IBM DB2
  • IBM InformixIBM Informix
  • IBM MQIBM MQ
  • MySQLMySQL
  • Oracle 数据库Oracle Database
  • PostgreSQLPostgreSQL
  • SAPSAP
  • SharePoint ServerSharePoint Server
  • SQL ServerSQL Server
  • TeradataTeradata

Azure 逻辑应用支持通过数据网关进行读取和写入操作。Azure Logic Apps supports read and write operations through the data gateway. 但是,这些操作存在有效负载大小限制However, these operations have limits on their payload size. 虽然网关本身不额外收费,但逻辑应用定价模型适用于这些连接器以及 Azure 逻辑应用中的其他操作。Although the gateway itself doesn't incur additional costs, the Logic Apps pricing model applies to these connectors and other operations in Azure Logic Apps.

先决条件Prerequisites

  • 已经在本地计算机上安装本地数据网关You already installed the on-premises data gateway on a local computer.

  • 你使用的 Azure 帐户和订阅与安装该数据网关时使用的帐户和订阅相同。You're using the same Azure account and subscription that was used when installing that data gateway. 此 Azure 帐户必须属于单个 Azure Active Directory (Azure AD) 租户或目录This Azure account must belong to a single Azure Active Directory (Azure AD) tenant or directory.

  • 网关安装尚未由另一 Azure 网关资源注册并声明。Your gateway installation isn't already registered and claimed by another Azure gateway resource.

    在 Azure 门户中创建网关资源时,请选择一个与你的网关资源相关联且仅与该网关资源相关联的网关安装。When you create a gateway resource in the Azure portal, you select a gateway installation, which links to your gateway resource and only that gateway resource. 然后,在 Azure 逻辑应用中,本地触发器和操作将使用网关资源连接到本地数据源。In Azure Logic Apps, on-premises triggers and actions then use the gateway resource for connecting to on-premises data sources. 在这些触发器和操作中,请选择需要使用的 Azure 订阅和关联的网关资源。In these triggers and actions, you select your Azure subscription and the associated gateway resource that you want to use. 每个网关资源只关联到一个网关安装,后者仅关联到一个 Azure 帐户。Each gateway resource links to only one gateway installation, which links to only one Azure account.

    备注

    只有网关管理员才能在 Azure 门户中创建网关资源。Only the gateway administrator can create the gateway resource in the Azure portal. 当前不支持服务主体。Currently, service principals aren't supported.

创建 Azure 网关资源Create Azure gateway resource

在本地计算机上安装网关后,请为网关创建 Azure 资源。After you install the gateway on a local computer, create the Azure resource for your gateway.

  1. 使用安装网关时所使用的 Azure 帐户登录到 Azure 门户Sign in to the Azure portal with the same Azure account that was used to install the gateway.

  2. 在 Azure 门户搜索框中输入“本地数据网关”,然后选择“本地数据网关”。In the Azure portal search box, enter "on-premises data gateway", and select On-premises Data Gateways.

    查找“本地数据网关”

  3. 在“本地数据网关”下,选择“添加”。 Under On-premises Data Gateways, select Add.

    为数据网关添加新的 Azure 资源

  4. 在“创建连接网关”下,提供网关资源的以下信息。Under Create connection gateway, provide this information for your gateway resource. 完成操作后,选择“创建”。When you're done, select Create.

    属性Property 说明Description
    资源名称Resource Name 为网关资源提供一个名称,其中只包含字母、数字、连字符 (-)、下划线 (_)、括号(())或句点 (.)。Provide a name for your gateway resource that contains only letters, numbers, hyphens (-), underscores (_), parentheses ((, )), or periods (.).
    订阅Subscription 选择曾用于网关安装的 Azure 帐户的 Azure 订阅。Select the Azure subscription for the Azure account that was used for the gateway installation. 默认订阅取决于用来登录的 Azure 帐户。The default subscription is based on the Azure account that you used to sign in.
    资源组Resource group 要使用的 Azure 资源组The Azure resource group that you want to use
    位置Location 网关安装期间为网关云服务选择的区域或位置。The same region or location that was selected for the gateway cloud service during gateway installation. 否则,网关安装不会显示在“安装名称”列表中。Otherwise, your gateway installation won't appear in the Installation Name list. 逻辑应用位置可能不同于网关资源位置。Your logic app location can differ from your gateway resource location.
    安装名称Installation Name 选择一个网关安装,该安装仅在以下条件满足的情况下显示在列表中:Select a gateway installation, which appears in the list only when these conditions are met:

    - 网关安装使用的区域与要创建的网关资源所在的区域相同。- The gateway installation uses the same region as the gateway resource that you want to create.
    - 网关安装未关联到另一 Azure 网关资源。- The gateway installation isn't linked to another Azure gateway resource.
    - 网关安装关联到要用来创建网关资源的 Azure 帐户。- The gateway installation is linked to the same Azure account that you're using to create the gateway resource.
    - 你的 Azure 帐户属于单个 Azure Active Directory (Azure AD) 租户或目录,是用于网关安装的帐户。- Your Azure account belongs to a single Azure Active Directory (Azure AD) tenant or directory and is the same account that was used for the gateway installation.

    有关详细信息,请参阅常见问题解答部分。For more information, see the Frequently asked questions section.

    以下示例演示的网关安装位于你的网关资源所在的区域,并关联到同一 Azure 帐户:Here is an example that shows a gateway installation that's in the same region as your gateway resource and is linked to the same Azure account:

    提供创建数据网关资源所需的详细信息

连接到本地数据Connect to on-premises data

创建网关资源并将 Azure 订阅与此资源相关联后,可以使用该网关在逻辑应用与本地数据源之间创建连接。After you create your gateway resource and associate your Azure subscription with this resource, you can now create a connection between your logic app and your on-premises data source by using the gateway.

  1. 在 Azure 门户的逻辑应用设计器中创建或打开逻辑应用。In the Azure portal, create or open your logic app in the Logic App Designer.

  2. 添加支持本地连接的连接器,例如 SQL ServerAdd a connector that supports on-premises connections, for example, SQL Server.

  3. 选择“通过本地数据网关连接”。Select Connect via on-premises data gateway.

  4. 在“网关”下,从“订阅”列表中选择 你的 Azure 订阅,该订阅有你需要的网关资源。Under Gateways, from the Subscriptions list, select your Azure subscription that has the gateway resource you want.

  5. 从“连接网关”列表中选择所需网关资源,该列表会显示所选订阅中的可用网关资源。From the Connection Gateway list, which shows the available gateway resources in your selected subscription, select the gateway resource that you want. 每个网关资源关联到单个网关安装。Each gateway resource is linked to a single gateway installation.

    备注

    网关列表包含其他区域的网关资源,因为逻辑应用的位置可能不同于网关资源的位置。The gateways list includes gateway resources in other regions because your logic app's location can differ from your gateway resource's location.

  6. 提供唯一的连接名称和其他所需信息,具体取决于要创建的连接。Provide a unique connection name and other required information, which depends on the connection that you want to create.

    唯一的连接名称有助于在以后轻松查找该连接,尤其是在创建多个连接的情况下。A unique connection name helps you easily find that connection later, especially if you create multiple connections. 另请包括用户名的限定域(如果适用)。If applicable, also include the qualified domain for your username.

    以下是示例:Here is an example:

    在逻辑应用和数据网关之间创建连接

  7. 完成操作后,选择“创建”。When you're done, select Create.

网关连接现在已准备就绪,可供逻辑应用使用。Your gateway connection is now ready for your logic app to use.

编辑连接Edit connection

若要更新网关连接的设置,可以编辑连接。To update the settings for a gateway connection, you can edit your connection.

  1. 若要查找你的逻辑应用的所有 API 连接,请在逻辑应用菜单中的“开发工具”下,选择“API 连接”。 To find all the API connections for just your logic app, on your logic app's menu, under Development Tools, select API connections.

    在逻辑应用菜单上,选择“API 连接”

  2. 选择所需的网关连接,然后选择“编辑 API 连接”。Select the gateway connection you want, and then select Edit API connection.

    提示

    如果更新未生效,请尝试针对网关安装停止网关 Windows 服务帐户,然后重启该帐户If your updates don't take effect, try stopping and restarting the gateway Windows service account for your gateway installation.

查找与 Azure 订阅关联的所有 API 连接:To find all API connections associated with your Azure subscription:

  • 在 Azure 门户菜单中,选择“所有服务” > “Web” > “API 连接”。From the Azure portal menu, select All services > Web > API Connections.
  • 或者,在 Azure 门户菜单中,选择“所有资源”。Or, from the Azure portal menu, select All resources. 将“类型”筛选器设置为“API 连接”。Set the Type filter to API Connection.

删除网关资源Delete gateway resource

若要创建其他网关资源、将网关安装与其他网关资源相关联,或者移除网关资源,则可删除网关资源,不影响网关安装。To create a different gateway resource, link your gateway installation to a different gateway resource, or remove the gateway resource, you can delete the gateway resource without affecting the gateway installation.

  1. 在 Azure 门户菜单中选择“所有资源”,或从任何页面搜索并选择“所有资源”。From the Azure portal menu, select All resources, or search for and select All resources from any page. 找到并选择所需的网关资源。Find and select your gateway resource.

  2. 如果尚未选择,请在网关资源菜单中选择“本地数据网关”。If not already selected, on your gateway resource menu, select On-premises Data Gateway. 在网关资源工具栏上,选择“删除”。On the gateway resource toolbar, select Delete.

    例如:For example:

    删除 Azure 中的网关资源

常见问题Frequently asked questions

:在 Azure 中创建我的网关资源时,为何不显示我的网关安装?Q: Why doesn't my gateway installation appear when I create my gateway resource in Azure?
:此问题的可能原因如下:A: This issue can happen for these reasons:

  • Azure 帐户必须是关联到本地计算机上的网关安装的帐户。Your Azure account must be the same account that's linked to the gateway installation on the local computer. 请检查你是否使用了关联到网关安装的标识登录到 Azure 门户。Check that you're signed in to the Azure portal with the same identity that's linked to the gateway installation. 另请确保你的 Azure 帐户属于单个 Azure AD 租户或目录,并已设置为在网关安装过程中使用过的 Azure AD 租户或目录。Also, make sure that your Azure account belongs to a single Azure AD tenant or directory and is set to the same Azure AD tenant or directory that was used during gateway installation.

  • 网关资源和网关安装必须使用同一区域。Your gateway resource and gateway installation have to use the same region. 但是,逻辑应用位置可以不同于网关资源位置。However, your logic app location can differ from your gateway resource location.

  • 网关安装已由另一网关资源注册并声明。Your gateway installation is already registered and claimed by another gateway resource. 这些安装不会显示在“安装名称”列表中。These installations won't appear in the Installation Name list. 若要在 Azure 门户中查看网关注册,请找到所有 Azure 订阅的“本地数据网关”类型的所有 Azure 资源。To review your gateway registrations in the Azure portal, find all your Azure resources that have the On-premises Data Gateways type across all your Azure subscriptions. 若要取消关联其他网关资源中的网关安装,请参阅删除网关资源To unlink the gateway installation from the other gateway resource, see Delete gateway resource.

:我的现有网关的位置为何发生了更改?Q: Why did the location for my existing gateway change?
:2017 年 5 月 3 日之前创建的网关资源已经移到了创建这些网关的工作或学校帐户的 Azure AD 租户的原始位置。A: Gateway resources created before May 3, 2017 were moved to the original locations of the Azure AD tenant for the work or school account that created those gateways. 但是,这些更改应当不会影响当前正在运行的逻辑应用,这些应用应当继续照常运行。However, these changes shouldn't affect currently running logic apps, which should continue working as usual. 随着该网关在五月份的正式发布,网关资源的位置可能不同于逻辑应用位置。With the gateway's general availability in May, gateway resource locations can differ from logic app locations.

后续步骤Next steps