我正在尝试通过Data Factory的Web活动将消息发送到事件中心。
“我的数据工厂”使用系统分配的受管理身份(MSI)进行设置,并且该身份已在事件中心命名空间(RBAC / IAM)上被赋予“ Azure事件中心数据发送者”角色。
Web活动设置如下:
{
"name": "Send to Event Hub",
"type": "WebActivity",
"dependsOn": [],
"policy": {
"timeout": "7.00:00:00",
"retry": 0,
"retryIntervalInSeconds": 30,
"secureOutput": false,
"secureInput": false
},
"userProperties": [],
"typeProperties": {
"url": "https://<eventhubnamespace>.servicebus.windows.net/<eventhub>/messages?timeout=60&api-version=2014-01",
"method": "POST",
"body": {
"DeviceId": "dev-01",
"Temperature": "37.0"
},
"authentication": {
"type": "MSI",
"resource": "https://servicebus.azure.net"
}
}
}
不幸的是,该请求似乎总是未经授权的。网络活动失败,并显示以下消息:
{
"errorCode": "2108",
"message": "Invoking Web Activity failed with HttpStatusCode - 'Unauthorized'.",
"failureType": "UserError",
"target": "Event Hub",
"details": []
}
我还尝试根据send event REST API docs指定Content-Type标头,但这没什么区别。
根据this article,应该可以使用带有OAuth2.0 Bearer令牌的服务主体针对事件中心进行身份验证。我的理解是,ADF的MSI与服务主体没有什么不同,除了我不必自己管理机密和令牌。我想念什么?