获取 Azure 数据工厂日志

Get Azure Data Factory logs

我需要检索 Azure 数据工厂管道执行日志。我已经通过使用以下请求尝试使用 Web 活动:

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/pipelineruns/{runId}?api-version=2018-06-01

不幸的是我有以下错误:

Invoking Web Activity failed with HttpStatusCode - 'NotFound', message - 'The requested resource does not exist on the server. Please verify the request server and retry'

我是否应该设置一些额外的配置才能检索这些日志?

您可以使用 Pipeline Runs - Query By Factory

获取管道列表 运行s

接下来,您可以通过 运行 ID 获取管道 运行。

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/pipelineruns/{runId}?api-version=2018-06-01

这是一个示例 URL:

https://management.azure.com/subscriptions/b83c1ed3-XXXX-XXX-XXXXX-2n83a074t23f/resourceGroups/resource-grp/providers/Microsoft.DataFactory/factories/ktestadf/pipelineruns/0bdaba11-47b7-4885-9796-5801b4bb856a?api-version=2018-06-01

如果您正在动态构造URL,使用Pipeline RunID 系统变量,您可以使用字符串插值方法。注意 @{pipeline().RunId} 代替 {运行Id}.

https://management.azure.com/subscriptions/b83c1ed3-XXXX-XXXX-XXXXX-2n83a074t23f/resourceGroups/resource-grp/providers/Microsoft.DataFactory/factories/ktestadf/pipelineruns/@{pipeline().RunId}?api-version=2018-06-01

Note: You would have to Trigger run and not debug, since this will create pipeline. Make sure you have published all before trigering run, debug can take the changes but pipeline run needs the changes be published.

这是一个简单的 WebActivity 设置:

输入

{
    "url": " https://management.azure.com/subscriptions/b83c1td3-XXXX-XXXX-XXXXX-2b83a074c13f/resourceGroups/myrg/providers/Microsoft.DataFactory/factories/ktestadf/pipelineruns/0bdaba11-47b7-4885-9796-5801b4bb856a?api-version=2018-06-01 ",
    "method": "GET",
    "headers": {
        "Content-Type": "application/json"
    },
    "authentication": {
        "type": "MSI",
        "resource": " https://management.azure.com/  "
    }
}

您可以从此处手动获取管道 运行 ID 以进行测试。

我在发布此之前进行了重现,出现此错误的唯一原因是您提供的任何值都是错误的或不存在(在管道 运行 id 的情况下)