重要说明
本页包含使用 Kubernetes 部署清单(目前为预览版)管理 Azure IoT 操作组件的说明。 此功能存在若干限制,不应该用于生产工作负载。
有关 beta 版本、预览版或尚未正式发布的版本的 Azure 功能所适用的法律条款,请参阅 Microsoft Azure 预览版的补充使用条款。
要在 Azure IoT 操作中将数据发送到 Microsoft Fabric OneLake,可以配置数据流终结点。 借助此配置,可以指定目标终结点、身份验证方法、表和其他设置。
先决条件
为托管标识分配权限
要为 Microsoft Fabric OneLake 配置数据流终结点,建议使用用户分配的托管标识或系统分配的托管标识。 此方法是安全的,并且无需手动管理凭据。
创建 Microsoft Fabric OneLake 后,需要为 Azure IoT 操作托管标识分配一个角色,以授予写入 Fabric 湖屋的权限。
如果使用系统分配的托管标识,请在 Azure 门户中转到 Azure IoT 操作实例并选择“概述”。 复制“Azure IoT 操作 Arc 扩展”后列出的扩展名称。 例如 azure-iot-operations-xxxx7。 可以使用 Azure IoT 操作 Arc 扩展的名称查找系统分配的托管标识。
转到所创建的 Microsoft Fabric 工作区,选择“管理访问”“+ 添加人员或组”。>
- 搜索为云连接设置的用户分配的托管标识或系统分配的托管标识的名称。 例如 azure-iot-operations-xxxx7。
- 选择“参与者”作为角色,然后选择“添加”。 此操作向托管标识提供写入 Fabric 湖屋所需的权限。 要了解详细信息,请参阅 Microsoft Fabric 工作区中的角色。
创建 Microsoft Fabric OneLake 的数据流终结点
在操作体验中,选择“数据流终结点”选项卡。
在“新建数据流终结点”下,选择“Microsoft Fabric OneLake”“新建”。>
输入以下用于终结点的设置:
设置 |
说明 |
主机 |
Microsoft Fabric OneLake 终结点的主机名,格式为 onelake.dfs.fabric.microsoft.com 。 |
湖屋名称 |
应存储数据的湖屋的名称。 |
工作区名称 |
与湖屋关联的工作区的名称。 |
OneLake 路径类型 |
OneLake 中使用的路径类型。 选择“文件”或“表”。 |
身份验证方法 |
用于身份验证的方法。 选择“系统分配的托管标识”或“用户分配的托管标识”。 |
客户端 ID |
用户分配的托管标识的客户端 ID。 如果使用的是“用户分配的托管标识”,则为必需。 |
租户 ID |
用户分配的托管标识的租户 ID。 如果使用的是“用户分配的托管标识”,则为必需。 |
选择“应用”以预配终结点。
创建或替换
使用 az iot ops 数据流终结点 create fabric-onelake 命令创建或替换 Microsoft Fabric OneLake 数据流终结点。
az iot ops dataflow endpoint create fabric-onelake --resource-group <ResourceGroupName> --instance <AioInstanceName> --name <EndpointName> --workspace <WorkspaceName> --lakehouse <LakehouseName> --path-type <PathType>
参数 --workspace
是 Microsoft Fabric 工作区的名称。
--lakehouse
是工作区中 Microsoft Fabric 湖屋的名称。 参数 --path-type
指定 OneLake 路径类型,可以是或 Tables
Files
。
下面是用于创建或替换名为 fabric-endpoint
的 Microsoft Fabric OneLake 数据流终结点的示例命令:
az iot ops dataflow endpoint create fabric-onelake --resource-group myResourceGroup --instance myAioInstance --name fabric-endpoint --workspace myWorkspace --lakehouse myLakehouse --path-type Tables
创建或更改
使用 az iot ops dataflow endpoint apply 命令来创建或修改 Microsoft Fabric OneLake 的数据流端点。
az iot ops dataflow endpoint apply --resource-group <ResourceGroupName> --instance <AioInstanceName> --name <EndpointName> --config-file <ConfigFilePathAndName>
参数 --config-file
是包含资源属性的 JSON 配置文件的路径和文件名。
在此示例中,假定一个配置文件 fabric-endpoint.json
,其中包含存储在用户主目录中的以下内容:
{
"endpointType": "FabricOneLake",
"fabricOneLakeSettings": {
"authentication": {
"method": "SystemAssignedManagedIdentity",
"systemAssignedManagedIdentitySettings": {}
},
"batching": {
"latencySeconds": 60,
"maxMessages": 100000
},
"host": "https://onelake.dfs.fabric.microsoft.com",
"oneLakePathType": "Tables",
"names": {
"workspaceName": "<WorkspaceName>",
"lakehouseName": "<LakehouseName>"
}
}
}
下面是一个示例命令,用于创建新的Microsoft Fabric OneLake 数据流终结点,名为 fabric-endpoint
:
az iot ops dataflow endpoint apply --resource-group myResourceGroupName --instance myAioInstanceName --name fabric-endpoint --config-file ~/fabric-endpoint.json
创建包含以下内容的 Bicep .bicep
文件。
param aioInstanceName string = '<AIO_INSTANCE_NAME>'
param customLocationName string = '<CUSTOM_LOCATION_NAME>'
param endpointName string = '<ENDPOINT_NAME>'
param workspaceName string = '<WORKSPACE_NAME>'
param lakehouseName string = '<LAKEHOUSE_NAME>'
resource aioInstance 'Microsoft.IoTOperations/instances@2024-11-01' existing = {
name: aioInstanceName
}
resource customLocation 'Microsoft.ExtendedLocation/customLocations@2021-08-31-preview' existing = {
name: customLocationName
}
resource oneLakeEndpoint 'Microsoft.IoTOperations/instances/dataflowEndpoints@2024-11-01' = {
parent: aioInstance
name: endpointName
extendedLocation: {
name: customLocation.id
type: 'CustomLocation'
}
properties: {
endpointType: 'FabricOneLake'
fabricOneLakeSettings: {
// The default Fabric OneLake host URL in most cases
host: 'https://onelake.dfs.fabric.microsoft.com'
authentication: {
// See available authentication methods section for method types
// method: <METHOD_TYPE>
}
oneLakePathType: 'Tables'
names: {
workspaceName: workspaceName
lakehouseName: lakehouseName
}
}
}
}
然后,通过 Azure CLI 进行部署。
az deployment group create --resource-group <RESOURCE_GROUP> --template-file <FILE>.bicep
创建包含以下内容的 Kubernetes 清单 .yaml
文件。
apiVersion: connectivity.iotoperations.azure.com/v1
kind: DataflowEndpoint
metadata:
name: <ENDPOINT_NAME>
namespace: azure-iot-operations
spec:
endpointType: FabricOneLake
fabricOneLakeSettings:
# The default Fabric OneLake host URL in most cases
host: https://onelake.dfs.fabric.microsoft.com
authentication:
# See available authentication methods section for method types
# method: <METHOD_TYPE>
oneLakePathType: Tables
names:
workspaceName: <WORKSPACE_NAME>
lakehouseName: <LAKEHOUSE_NAME>
然后,将清单文件应用到 Kubernetes 群集。
kubectl apply -f <FILE>.yaml
OneLake 路径类型
oneLakePathType
设置确定要在 OneLake 路径中使用的路径类型。 默认值为 Tables
,这是最常见的用例的建议路径类型。
Tables
路径类型是 OneLake 湖屋中用于存储数据的表。 它还可以设置为 Files
,这是 OneLake 湖屋中用于存储数据的文件。 如果要以 Files
路径类型不支持的文件格式存储数据,则 Tables
路径类型会非常有用。
OneLake 路径类型是在数据流终结点的“基本”选项卡中设置的。
如果使用 az iot ops 数据流终结点 create fabric-onelake 命令,则 --path-type
参数指定 OneLake 路径类型,可以是或 Tables
Files
。
az iot ops dataflow endpoint create fabric-onelake --resource-group <ResourceGroupName> --instance <AioInstanceName> --name <EndpointName> --workspace <WorkspaceName> --lakehouse <LakehouseName> --path-type <PathType>
如果使用 az iot ops dataflow endpoint apply,则在 JSON 配置文件中设置 oneLakePathType
属性。
{
"endpointType": "FabricOneLake",
"fabricOneLakeSettings": {
"oneLakePathType": "Tables"
}
}
fabricOneLakeSettings: {
oneLakePathType: 'Tables' // Or 'Files'
}
fabricOneLakeSettings:
oneLakePathType: Tables # Or Files
可用的身份验证方法
以下身份验证方法可用于 Microsoft Fabric OneLake 数据流终结点。
系统分配的托管标识
在配置数据流终结点之前,请为 Azure IoT 操作托管标识分配角色,以授予写入 Fabric 湖屋的权限:
- 在 Azure 门户中,转到 Azure IoT 操作实例并选择“概述”。
- 复制“Azure IoT 操作 Arc 扩展”后列出的扩展名称。 例如 azure-iot-operations-xxxx7。
- 转到 Microsoft Fabric 工作区,选择“管理访问”“+ 添加人员或组”。>
- 搜索系统分配的托管标识的名称。 例如 azure-iot-operations-xxxx7。
- 选择相应的角色,然后选择“添加”。
然后,使用系统分配的托管标识设置配置数据流终结点。
在操作体验数据流终结点设置页中,选择“基本”选项卡,然后选择“身份验证方法”“系统分配的托管标识”。>
创建或替换
使用 az iot ops 数据流终结点 create fabric-onelake 命令创建或替换 Microsoft Fabric OneLake 数据流终结点。
az iot ops dataflow endpoint create fabric-onelake --auth-type SystemAssignedManagedIdentity --resource-group <ResourceGroupName> --instance <AioInstanceName> --name <EndpointName> --workspace <WorkspaceName> --lakehouse <LakehouseName> --path-type <PathType>
参数 --workspace
是 Microsoft Fabric 工作区的名称。
--lakehouse
是工作区中 Microsoft Fabric 湖屋的名称。 参数 --path-type
指定 OneLake 路径类型,可以是或 Tables
Files
。
下面是用于创建或替换名为 fabric-endpoint
的 Microsoft Fabric OneLake 数据流终结点的示例命令:
az iot ops dataflow endpoint create fabric-onelake --resource-group myResourceGroup --instance myAioInstance --name fabric-endpoint --workspace myWorkspace --lakehouse myLakehouse --path-type Tables
创建或更改
使用 az iot ops dataflow endpoint apply 命令来创建或修改 Microsoft Fabric OneLake 的数据流端点。
az iot ops dataflow endpoint apply --resource-group <ResourceGroupName> --instance <AioInstanceName> --name <EndpointName> --config-file <ConfigFilePathAndName>
参数 --config-file
是包含资源属性的 JSON 配置文件的路径和文件名。
在此示例中,假定一个配置文件 fabric-endpoint.json
,其中包含存储在用户主目录中的以下内容:
{
"endpointType": "FabricOneLake",
"fabricOneLakeSettings": {
"authentication": {
"method": "SystemAssignedManagedIdentity",
"systemAssignedManagedIdentitySettings": {}
},
"batching": {
"latencySeconds": 60,
"maxMessages": 100000
},
"host": "https://onelake.dfs.fabric.microsoft.com",
"oneLakePathType": "Tables",
"names": {
"workspaceName": "<WorkspaceName>",
"lakehouseName": "<LakehouseName>"
}
}
}
下面是一个示例命令,用于创建新的Microsoft Fabric OneLake 数据流终结点,名为 fabric-endpoint
:
az iot ops dataflow endpoint apply --resource-group myResourceGroupName --instance myAioInstanceName --name fabric-endpoint --config-file ~/fabric-endpoint.json
fabricOneLakeSettings: {
authentication: {
method: 'SystemAssignedManagedIdentity'
systemAssignedManagedIdentitySettings: {}
}
}
fabricOneLakeSettings:
authentication:
method: SystemAssignedManagedIdentity
systemAssignedManagedIdentitySettings:
{}
如果需要替代系统分配的托管标识受众,则可以指定 audience
设置。
大多数情况下,无需指定服务受众。 不指定受众将会创建一个托管标识,其默认受众范围限定为存储帐户。
创建或替换
使用 az iot ops 数据流终结点 create fabric-onelake 命令创建或替换 Microsoft Fabric OneLake 数据流终结点。
az iot ops dataflow endpoint create fabric-onelake --auth-type SystemAssignedManagedIdentity fabric-onelake --audience https://<account>.onelake.dfs.fabric.microsoft.com --resource-group <ResourceGroupName> --instance <AioInstanceName> --name <EndpointName> --workspace <WorkspaceName> --lakehouse <LakehouseName> --path-type <PathType>
该 --audience
参数指定系统分配的托管标识的受众。 默认受众为 https://<account>.onelake.dfs.fabric.microsoft.com
。
下面是用于创建或替换名为 fabric-endpoint
的 Microsoft Fabric OneLake 数据流终结点的示例命令:
az iot ops dataflow endpoint create fabric-onelake --auth-type SystemAssignedManagedIdentity --audience https://account.onelake.dfs.fabric.microsoft.com --resource-group myResourceGroup --instance myAioInstance --name fabric-endpoint --workspace myWorkspace --lakehouse myLakehouse --path-type Tables
创建或更改
使用 az iot ops dataflow endpoint apply 命令来创建或修改 Microsoft Fabric OneLake 的数据流端点。
az iot ops dataflow endpoint apply --resource-group <ResourceGroupName> --instance <AioInstanceName> --name <EndpointName> --config-file <ConfigFilePathAndName>
参数 --config-file
是包含资源属性的 JSON 配置文件的路径和文件名。
在此示例中,假定一个配置文件 fabric-endpoint.json
,其中包含存储在用户主目录中的以下内容:
{
"endpointType": "FabricOneLake",
"fabricOneLakeSettings": {
"authentication": {
"method": "SystemAssignedManagedIdentity",
"systemAssignedManagedIdentitySettings": {
"audience": "https://<account>.onelake.dfs.fabric.microsoft.com"
}
},
"batching": {
"latencySeconds": 60,
"maxMessages": 100000
},
"host": "https://onelake.dfs.fabric.microsoft.com",
"oneLakePathType": "Tables",
"names": {
"workspaceName": "<WorkspaceName>",
"lakehouseName": "<LakehouseName>"
}
}
}
下面是一个示例命令,用于创建新的Microsoft Fabric OneLake 数据流终结点,名为 fabric-endpoint
:
az iot ops dataflow endpoint apply --resource-group myResourceGroupName --instance myAioInstanceName --name fabric-endpoint --config-file ~/fabric-endpoint.json
fabricOneLakeSettings: {
authentication: {
method: 'SystemAssignedManagedIdentity'
systemAssignedManagedIdentitySettings: {
audience: 'https://<ACCOUNT>.onelake.dfs.fabric.microsoft.com'
}
}
}
fabricOneLakeSettings:
authentication:
method: SystemAssignedManagedIdentity
systemAssignedManagedIdentitySettings:
audience: https://<ACCOUNT>.onelake.dfs.fabric.microsoft.com
用户分配的托管标识
要使用用户分配的托管标识进行身份验证,必须先部署已启用安全设置的 Azure IoT 操作。 然后,需要设置用户分配的托管标识以进行云连接。 要了解详细信息,请参阅在 Azure IoT 操作部署中启用安全设置。
在配置数据流终结点之前,请给用户分配的托管身份分配一个角色,该角色授予其写入 Fabric Lakehouse 的权限。
- 转到 Microsoft Fabric 工作区,选择“管理访问”“+ 添加人员或组”。>
- 搜索用户分配的托管标识的名称。
- 选择相应的角色,然后选择“添加”。
然后,使用用户分配的托管标识设置配置数据流终结点。
在操作体验数据流终结点设置页中,选择“基本”选项卡,然后选择“身份验证方法”“用户分配的托管标识”。>
在相应的字段中输入用户分配的托管标识客户端 ID 和租户 ID。
创建或替换
使用 az iot ops dataflow endpoint create fabric-onelake 命令使用用户分配的托管标识创建或替换 Microsoft Fabric OneLake 数据流终结点。
az iot ops dataflow endpoint create fabric-onelake --auth-type UserAssignedManagedIdentity --client-id <ClientId> --tenant-id <TenantId> --scope <Scope> --resource-group <ResourceGroupName> --instance <AioInstanceName> --name <EndpointName> --workspace <WorkspaceName> --lakehouse <LakehouseName> --path-type <PathType>
该 --auth-type
参数指定身份验证方法, UserAssignedManagedIdentity
在本例中。
--client-id
、--tenant-id
和--scope
参数分别指定用户分配的托管标识客户端 ID、租户 ID 和作用域。
下面是用于创建或替换名为 fabric-endpoint
的 Microsoft Fabric OneLake 数据流终结点的示例命令:
示例命令:
az iot ops dataflow endpoint create fabric-onelake --auth-type UserAssignedManagedIdentity --client-id ClientId --tenant-id TenantId --scope https://storage.azure.com/.default --resource-group myResourceGroup --instance myAioInstance --name fabric-endpoint --workspace myWorkspace --lakehouse myLakehouse --path-type Tables
创建或更改
使用 az iot ops dataflow endpoint apply 命令使用用户分配的托管标识创建或更改 Microsoft Fabric OneLake 数据流终结点。
az iot ops dataflow endpoint apply --resource-group <ResourceGroupName> --instance <AioInstanceName> --name <EndpointName> --config-file <ConfigFilePathAndName>
参数 --config-file
是包含资源属性的 JSON 配置文件的路径和文件名。
示例 fabric-endpoint.json
:
{
"endpointType": "FabricOneLake",
"fabricOneLakeSettings": {
"authentication": {
"method": "UserAssignedManagedIdentity",
"userAssignedManagedIdentitySettings": {
"clientId": "<ClientId>",
"scope": "<Scope>",
"tenantId": "<TenantId>"
}
},
"batching": {
"latencySeconds": 60,
"maxMessages": 100000
},
"host": "https://onelake.dfs.fabric.microsoft.com",
"oneLakePathType": "Tables",
"names": {
"workspaceName": "<WorkspaceName>",
"lakehouseName": "<LakehouseName>"
}
}
}
示例命令:
az iot ops dataflow endpoint apply --resource-group myResourceGroupName --instance myAioInstanceName --name fabric-endpoint --config-file ~/fabric-endpoint.json
fabricOneLakeSettings: {
authentication: {
method: 'UserAssignedManagedIdentity'
userAssignedManagedIdentitySettings: {
clientId: '<ID>'
tenantId: '<ID>'
// Optional, defaults to 'https://storage.azure.com/.default'
// scope: 'https://<SCOPE_URL>'
}
}
}
要使用用户分配的托管标识,请指定 UserAssignedManagedIdentity
身份验证方法并提供托管标识的 clientId
和 tenantId
。
fabricOneLakeSettings:
authentication:
method: UserAssignedManagedIdentity
userAssignedManagedIdentitySettings:
clientId: <ID>
tenantId: <ID>
# Optional, defaults to 'https://storage.azure.com/.default'
# scope: https://<SCOPE_URL>
在这里,范围是可选的,并且默认为 https://storage.azure.com/.default
。 如果需要替代默认范围,请使用 Bicep 或 Kubernetes 指定 scope
设置。
高级设置
可以为 Fabric OneLake 终结点设置高级设置,例如批处理延迟和消息计数。 可以在数据流终结点“高级”门户选项卡中或数据流终结点自定义资源中设置这些设置。
批处理
使用 batching
设置配置消息的最大数量和消息发送到目标之前的最大延迟。 如果要优化网络带宽并减少对目标的请求数,此设置会非常有用。
字段 |
说明 |
必需 |
latencySeconds |
将消息发送到目标之前要等待的最大秒数。 默认值为 60 秒。 |
否 |
maxMessages |
要发送到目标的最大消息数。 默认值为 100000 条消息。 |
否 |
例如,要将最大消息数配置为 1000,并将最大延迟配置为 100 秒,请使用以下设置:
在操作体验中,选择数据流终结点的“高级”选项卡。
使用 az iot ops dataflow endpoint apply 命令创建或更改 Microsoft Fabric OneLake 数据流终结点高级设置。
az iot ops dataflow endpoint apply --resource-group <ResourceGroupName> --instance <AioInstanceName> --name <EndpointName> --config-file <ConfigFilePathAndName>
参数 --config-file
是包含资源属性的 JSON 配置文件的路径和文件名。
在此示例中,假定一个配置文件 fabric-endpoint.json
,其中包含存储在用户主目录中的以下内容:
{
"endpointType": "FabricOneLake",
"fabricOneLakeSettings": {
"authentication": {
"method": "SystemAssignedManagedIdentity",
"systemAssignedManagedIdentitySettings": {}
},
"batching": {
"latencySeconds": 100,
"maxMessages": 1000
},
"host": "https://onelake.dfs.fabric.microsoft.com",
"oneLakePathType": "Tables",
"names": {
"workspaceName": "<WorkspaceName>",
"lakehouseName": "<LakehouseName>"
}
}
}
下面是一个示例命令,用于创建新的Microsoft Fabric OneLake 数据流终结点,名为 fabric-endpoint
:
az iot ops dataflow endpoint apply --resource-group myResourceGroupName --instance myAioInstanceName --name fabric-endpoint --config-file ~/fabric-endpoint.json
fabricOneLakeSettings: {
batching: {
latencySeconds: 100
maxMessages: 1000
}
}
fabricOneLakeSettings:
batching:
latencySeconds: 100
maxMessages: 1000
后续步骤
要了解有关数据流的详细信息,请参阅创建数据流。