尝试将消息从Azure数据工厂发送到服务总线时出现错误HTTP 401

xsuvu9jc  于 2022-12-19  发布在  其他
关注(0)|答案(1)|浏览(119)

我尝试在Azure环境中重现Hugh Woods实验(https://medium.com/asos-techblog/sending-messages-from-azure-data-factory-to-service-bus-86d4be6dd357),以便将消息从Azure DataFactory发送到Azure服务总线。
我已按照说明将“*Azure服务总线数据发送方 *”角色分配给我的 * 数据工厂的托管身份 *。
但是当我尝试向Service Bus发送消息时,我收到了以下错误:

Error code   : 2108
Failure type : User configuration issue
Details      : Invoking Web Activity failed with HttpStatusCode - 
               '401 : Unauthorized', message - ''
Source       : Pipeline Service Bus REST API

在本例中,我做错了什么?我的管道中有以下配置:

{
    "name": "Service Bus REST API",
    "properties": {
        "activities": [
            {
                "name": "Service Bus REST API",
                "description": "Teste",
                "type": "WebActivity",
                "dependsOn": [],
                "policy": {
                    "timeout": "7.00:00:00",
                    "retry": 0,
                    "retryIntervalInSeconds": 30,
                    "secureOutput": false,
                    "secureInput": false
                },
                "userProperties": [],
                "typeProperties": {
                    "url": "https://sb-namespace-dv.servicebus.windows.net/sbt-azure-adf-ntt-data-test/messages",
                    "method": "POST",
                    "headers": {
                        "CustomHeader-Version": "\"1.0\"",
                        "Content-Type": "application/json",
                        "BrokerProperties": {
                            "value": "@concat('{\"CorrelationId\": \"',pipeline().RunId,'\"}')",
                            "type": "Expression"
                        }
                    },
                    "body": {
                        "value": "{\"message\":{\"value\":\"@variables('OutputDetails')\",\"type\":\"Expression\"}}",
                        "type": "Expression"
                    },
                    "httpRequestTimeout": "00:10:00",
                    "authentication": {
                        "type": "MSI",
                        "resource": "https://servicebus.azure.net"
                    }
                }
            }
        ],
        "folder": {
            "name": "999_Others/9910_DevTest/TesteServiceBusADF"
        },
        "annotations": []
    }
}

我遵循了休·伍兹文章的所有步骤。我期望得到与他的实验相同的结果(见下图),但我没有成功。

{
message : "Snapshot Avaliable"
}
wfsdck30

wfsdck301#

您收到的消息是HTTP 401 Unauthorized,因此向服务总线写入数据的调用被拒绝。
有两种可能性:

  • 身份验证设置不正确
  • 您在角色分配传播之前进行了测试(可能需要5分钟)

参见:https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-managed-service-identity

相关问题