在 Azure 数据工厂中创建共享自承载集成运行时Create a shared self-hosted integration runtime in Azure Data Factory

适用于: Azure 数据工厂 Azure Synapse Analytics

本指南介绍如何在 Azure 数据工厂中创建共享自承载集成运行时。This guide shows you how to create a shared self-hosted integration runtime in Azure Data Factory. 然后可在另一个数据工厂中使用共享自托管集成运行时。Then you can use the shared self-hosted integration runtime in another data factory.

在 Azure 数据工厂中创建共享自承载集成运行时Create a shared self-hosted integration runtime in Azure Data Factory

可以重复使用已在数据工厂中设置的现有自承载集成运行时基础结构。You can reuse an existing self-hosted integration runtime infrastructure that you already set up in a data factory. 这种重复使用可以通过引用现有的共享自承载 IR,在不同的数据工厂中创建链接的自承载集成运行时。This reuse lets you create a linked self-hosted integration runtime in a different data factory by referencing an existing shared self-hosted IR.

使用 Azure 数据工厂 UI 创建共享自承载 IRCreate a shared self-hosted IR using Azure Data Factory UI

若要使用 Azure 数据工厂 UI 创建共享自承载 IR,可以执行以下步骤:To create a shared self-hosted IR using Azure Data Factory UI, you can take following steps:

  1. 在要共享的自承载 IR 中,选择“向另一个数据工厂授予权限”,然后在“集成运行时设置”页中,选择要在其中创建链接 IR 的数据工厂。In the self-hosted IR to be shared, select Grant permission to another Data factory and in the "Integration runtime setup" page, select the Data factory in which you want to create the linked IR.

    “共享”选项卡上的授予权限按钮

  2. 记下并复制上面要共享的自承载 IR 的“资源 ID”。Note and copy the above "Resource ID" of the self-hosted IR to be shared.

  3. 在已授予权限的数据工厂中,创建新的自承载 IR(链接),并输入资源 ID。In the data factory to which the permissions were granted, create a new self-hosted IR (linked) and enter the resource ID.

    用于创建自承载集成运行时的按钮

    用于创建链接的自承载集成运行时的按钮

    用于输入名称和资源 ID 的框

使用 Azure PowerShell 创建共享自承载 IRCreate a shared self-hosted IR using Azure PowerShell

若要使用 Azure PowerShell 创建共享自承载 IR,可以执行以下步骤:To create a shared self-hosted IR using Azure PowerShell, you can take following steps:

  1. 创建数据工厂。Create a data factory.
  2. 创建自我托管的集成运行时。Create a self-hosted integration runtime.
  3. 与其他数据工厂共享自承载集成运行时。Share the self-hosted integration runtime with other data factories.
  4. 创建链接的集成运行时。Create a linked integration runtime.
  5. 撤消共享。Revoke the sharing.

先决条件Prerequisites

备注

本文已经过更新,以便使用 Azure Az PowerShell 模块。This article has been updated to use the Azure Az PowerShell module. 若要与 Azure 交互,建议使用的 PowerShell 模块是 Az PowerShell 模块。The Az PowerShell module is the recommended PowerShell module for interacting with Azure. 若要开始使用 Az PowerShell 模块,请参阅安装 Azure PowerShellTo get started with the Az PowerShell module, see Install Azure PowerShell. 若要了解如何迁移到 Az PowerShell 模块,请参阅 将 Azure PowerShell 从 AzureRM 迁移到 AzTo learn how to migrate to the Az PowerShell module, see Migrate Azure PowerShell from AzureRM to Az.

备注

若要查看目前提供数据工厂的 Azure 区域列表,请选择你感兴趣的区域:可用产品(按区域)For a list of Azure regions in which Data Factory is currently available, select the regions that interest you on Products available by region.

创建数据工厂Create a data factory

  1. 启动 Windows PowerShell 集成脚本环境 (ISE)。Launch the Windows PowerShell Integrated Scripting Environment (ISE).

  2. 创建变量。Create variables. 复制并粘贴以下脚本。Copy and paste the following script. 将变量(例如 SubscriptionNameResourceGroupName)替换为实际值:Replace the variables, such as SubscriptionName and ResourceGroupName, with actual values:

    # If input contains a PSH special character, e.g. "$", precede it with the escape character "`" like "`$". 
    $SubscriptionName = "[Azure subscription name]" 
    $ResourceGroupName = "[Azure resource group name]" 
    $DataFactoryLocation = "ChinaEast2" 
    
    # Shared Self-hosted integration runtime information. This is a Data Factory compute resource for running any activities 
    # Data factory name. Must be globally unique 
    $SharedDataFactoryName = "[Shared Data factory name]" 
    $SharedIntegrationRuntimeName = "[Shared Integration Runtime Name]" 
    $SharedIntegrationRuntimeDescription = "[Description for Shared Integration Runtime]"
    
    # Linked integration runtime information. This is a Data Factory compute resource for running any activities
    # Data factory name. Must be globally unique
    $LinkedDataFactoryName = "[Linked Data factory name]"
    $LinkedIntegrationRuntimeName = "[Linked Integration Runtime Name]"
    $LinkedIntegrationRuntimeDescription = "[Description for Linked Integration Runtime]"
    
  3. 登录并选择一个订阅。Sign in and select a subscription. 在脚本中添加以下代码,以登录并选择 Azure 订阅:Add the following code to the script to sign in and select your Azure subscription:

    Connect-AzAccount -Environment AzureChinaCloud
    Select-AzSubscription -SubscriptionName $SubscriptionName
    
  4. 创建资源组和数据工厂。Create a resource group and a data factory.

    备注

    此步骤是可选的。This step is optional. 若已有数据工厂,请跳过此步骤。If you already have a data factory, skip this step.

    使用 New-AzResourceGroup 命令创建 Azure 资源组Create an Azure resource group by using the New-AzResourceGroup command. 资源组是在其中以组的形式部署和管理 Azure 资源的逻辑容器。A resource group is a logical container into which Azure resources are deployed and managed as a group. 以下示例在 ChinaEast2 位置创建名为 myResourceGroup 的资源组:The following example creates a resource group named myResourceGroup in the ChinaEast2 location:

    New-AzResourceGroup -Location $DataFactoryLocation -Name $ResourceGroupName
    

    运行以下命令以创建数据工厂:Run the following command to create a data factory:

    Set-AzDataFactoryV2 -ResourceGroupName $ResourceGroupName `
                             -Location $DataFactoryLocation `
                             -Name $SharedDataFactoryName
    

创建自承载 Integration RuntimeCreate a self-hosted integration runtime

备注

此步骤是可选的。This step is optional. 若已经拥有要与其他数据工厂共享的自承载集成运行时,请跳过此步骤。If you already have the self-hosted integration runtime that you want to share with other data factories, skip this step.

运行以下命令以创建自承载集成运行时:Run the following command to create a self-hosted integration runtime:

$SharedIR = Set-AzDataFactoryV2IntegrationRuntime `
    -ResourceGroupName $ResourceGroupName `
    -DataFactoryName $SharedDataFactoryName `
    -Name $SharedIntegrationRuntimeName `
    -Type SelfHosted `
    -Description $SharedIntegrationRuntimeDescription

获取集成运行时身份验证密钥并注册节点Get the integration runtime authentication key and register a node

运行以下命令以获取自承载集成运行时的身份验证密钥:Run the following command to get the authentication key for the self-hosted integration runtime:

Get-AzDataFactoryV2IntegrationRuntimeKey `
    -ResourceGroupName $ResourceGroupName `
    -DataFactoryName $SharedDataFactoryName `
    -Name $SharedIntegrationRuntimeName

响应包含此自承载集成运行时的身份验证密钥。The response contains the authentication key for this self-hosted integration runtime. 注册集成运行时节点时使用此密钥。You use this key when you register the integration runtime node.

安装并注册自承载集成运行时Install and register the self-hosted integration runtime

  1. Azure 数据工厂集成运行时下载自承载集成运行时安装程序。Download the self-hosted integration runtime installer from Azure Data Factory Integration Runtime.

  2. 运行安装程序以在本地计算机上安装自承载集成。Run the installer to install the self-hosted integration on a local computer.

  3. 使用你在上一步中检索的身份验证密钥注册新的自承载集成。Register the new self-hosted integration with the authentication key that you retrieved in a previous step.

与另一个数据工厂共享自承载集成运行时Share the self-hosted integration runtime with another data factory

创建另一个数据工厂Create another data factory

备注

此步骤是可选的。This step is optional. 若已拥有要共享的数据工厂,请跳过此步骤。If you already have the data factory that you want to share with, skip this step. 但若要向/从其他数据工厂添加或删除角色分配,你必须具有 Microsoft.Authorization/roleAssignments/writeMicrosoft.Authorization/roleAssignments/delete 权限,例如用户访问管理员所有者But in order to add or remove role assignments to other data factory, you must have Microsoft.Authorization/roleAssignments/write and Microsoft.Authorization/roleAssignments/delete permissions, such as User Access Administrator or Owner.

$factory = Set-AzDataFactoryV2 -ResourceGroupName $ResourceGroupName `
    -Location $DataFactoryLocation `
    -Name $LinkedDataFactoryName

授予权限Grant permission

向需要访问你创建和注册的自承载集成运行时的数据工厂授予权限。Grant permission to the data factory that needs to access the self-hosted integration runtime you created and registered.

重要

请勿跳过此步骤!Do not skip this step!

New-AzRoleAssignment `
    -ObjectId $factory.Identity.PrincipalId ` #MSI of the Data Factory with which it needs to be shared
    -RoleDefinitionName 'Contributor' `
    -Scope $SharedIR.Id

创建链接的自承载集成运行时Create a linked self-hosted integration runtime

运行以下命令以创建链接的自承载集成运行时:Run the following command to create a linked self-hosted integration runtime:

Set-AzDataFactoryV2IntegrationRuntime `
    -ResourceGroupName $ResourceGroupName `
    -DataFactoryName $LinkedDataFactoryName `
    -Name $LinkedIntegrationRuntimeName `
    -Type SelfHosted `
    -SharedIntegrationRuntimeResourceId $SharedIR.Id `
    -Description $LinkedIntegrationRuntimeDescription

现可在任何链接服务中使用此链接的集成运行时。Now you can use this linked integration runtime in any linked service. 链接的集成运行时使用共享集成运行时来运行活动。The linked integration runtime uses the shared integration runtime to run activities.

撤消数据工厂中的集成运行时共享Revoke integration runtime sharing from a data factory

若要从共享集成运行时中撤销数据工厂的访问权限,请运行以下命令:To revoke the access of a data factory from the shared integration runtime, run the following command:

Remove-AzRoleAssignment `
    -ObjectId $factory.Identity.PrincipalId `
    -RoleDefinitionName 'Contributor' `
    -Scope $SharedIR.Id

若要删除现有的链接集成运行时,请对共享集成运行时运行以下命令:To remove the existing linked integration runtime, run the following command against the shared integration runtime:

Remove-AzDataFactoryV2IntegrationRuntime `
    -ResourceGroupName $ResourceGroupName `
    -DataFactoryName $SharedDataFactoryName `
    -Name $SharedIntegrationRuntimeName `
    -Links `
    -LinkedDataFactoryName $LinkedDataFactoryName

监视Monitoring

共享 IRShared IR

用于查找共享集成运行时的选项

监视共享的集成运行时

链接 IRLinked IR

用于查找链接集成运行时的选项

监视链接的集成运行时

自承载 IR 共享的已知限制Known limitations of self-hosted IR sharing

  • 要在其中创建链接 IR 的数据工厂必须有一个托管标识The data factory in which a linked IR is created must have an Managed Identity. 默认情况下,在 Azure 门户或 PowerShell cmdlet 中创建的数据工厂已隐式创建了托管标识。By default, the data factories created in the Azure portal or PowerShell cmdlets have an implicitly created Managed Identity. 但是,如果数据工厂是通过 Azure 资源管理器模板或 SDK 创建的,则必须显式设置 Identity 属性。But when a data factory is created through an Azure Resource Manager template or SDK, you must set the Identity property explicitly. 此设置确保资源管理器创建包含托管标识的数据工厂。This setting ensures that Resource Manager creates a data factory that contains a Managed Identity.

  • 支持此功能的数据工厂 .NET SDK 必须是 1.1.0 或更高版本。The Data Factory .NET SDK that supports this feature must be version 1.1.0 or later.

  • 若要授予权限,需要在共享 IR 所在的数据工厂中拥有“所有者”角色或继承的“所有者”角色。To grant permission, you need the Owner role or the inherited Owner role in the data factory where the shared IR exists.

  • 共享功能仅适用于同一 Azure AD 租户中的数据工厂。The sharing feature works only for data factories within the same Azure AD tenant.

  • 对于 Azure AD 来宾用户,UI 中的搜索功能(通过使用搜索关键字列出所有数据工厂)将不起作用。For Azure AD guest users, the search functionality in the UI, which lists all data factories by using a search keyword, doesn't work. 但只要来宾用户是数据工厂的所有者,你就可以在不使用搜索功能的情况下共享 IR。But as long as the guest user is the owner of the data factory, you can share the IR without the search functionality. 对于需要共享 IR 的数据工厂的托管标识,请在“分配权限”框中输入该托管标识,然后在数据工厂 UI 中选择“添加”。For the Managed Identity of the data factory that needs to share the IR, enter that Managed Identity in the Assign Permission box and select Add in the Data Factory UI.

后续步骤Next steps