Search code examples
azureazure-data-factoryazure-rest-api

API for Getting ADF pipeline details


I was looking for an API which gives me the details of a Azure Datafactory Pipeline including start time,end time, duration etc. This is required to generate a report without manually looking into the ADF monitoring window


Solution

  • You can get a list of pipeline runs using Pipeline Runs - Query By Factory and then for each result run [Pipeline Runs - Query By Factory]

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

    Checkout the sample request here

    You can pick the necessary fields from the response body.

    {
      "value": [
        {
          "runId": "2f7fdb90-5df1-4b8e-ac2f-064cfa58202b",
          "pipelineName": "examplePipeline",
          "parameters": {
            "OutputBlobNameList": "[\"exampleoutput.csv\"]"
          },
          "invokedBy": {
            "id": "80a01654a9d34ad18b3fcac5d5d76b67",
            "name": "Manual"
          },
          "runStart": "2018-06-16T00:37:44.6257014Z",
          "runEnd": "2018-06-16T00:38:12.7314495Z",
          "durationInMs": 28105,
          "status": "Succeeded",
          "message": "",
          "lastUpdated": "2018-06-16T00:38:12.7314495Z",
          "annotations": [],
          "runDimension": {
            "JobId": "79c1cc52-265f-41a5-9553-be65e736fbd3"
          }
        },
        {
          "runId": "16ac5348-ff82-4f95-a80d-638c1d47b721",
          "pipelineName": "examplePipeline",
          "parameters": {
            "OutputBlobNameList": "[\"exampleoutput.csv\"]"
          },
          "invokedBy": {
            "id": "7c5fd7ef7e8a464b98b931cf15fcac66",
            "name": "Manual"
          },
          "runStart": "2018-06-16T00:39:49.2745128Z",
          "runEnd": null,
          "durationInMs": null,
          "status": "Cancelled",
          "message": "",
          "lastUpdated": "2018-06-16T00:39:51.216097Z",
          "annotations": [],
          "runDimension": {
            "JobId": "84a3c493-0628-4b44-852f-ef5b3a11bdab"
          }
        }
      ]
    }
    

    enter image description here

    And here is a simple WebActivity setup:

    enter image description here

    enter image description here

    Further, you can find similar queries answered by me here and here