Geezer
Geezer

Reputation: 497

ADF REST API for Activity Runs not returning data

I'm calling the Activity Runs Rest API from a parent pipeline to capture any errors in a child pipeline.

However, no data, of any kind, is being returned in the Value array.

Here are my settings.

enter image description here

Web activity

enter image description here

URL

https://management.azure.com/subscriptions/@{pipeline().globalParameters.SubscriptionId}/resourceGroups/@{pipeline().globalParameters.ResourceGrpName}/providers/Microsoft.DataFactory/factories/@{pipeline().DataFactory}/pipelineruns/@{pipeline().RunId}/queryActivityRuns?api-version=2018-06-01

Body

{   "lastUpdatedAfter": "2023-05-23T00:00:00.3345758Z",  
"lastUpdatedBefore": "2023-05-30T00:00:00.3686473Z" }

enter image description here

I've set an activity in the child pipeline to fail.

This is the response - nothing in the Value array

    {
        "value": [],
        "ADFWebActivityResponseHeaders": {
            "Pragma": "no-cache",
            "x-ms-correlation-request-id": "94cxxxx0-xxxx-xxxx-xxxx-b0842c922b3f",
...
        },
        "effectiveIntegrationRuntime": "AutoResolveIntegrationRuntime (West Europe)",
        "executionDuration": 0,
        "durationInQueue": {
            "integrationRuntimeQueue": 0
        },
        "billingReference": {
            "activityType": "ExternalActivity",
            "billableDuration": [
                {
                    "meterType": "AzureIR",
                    "duration": 0.016666666666666666,
                    "unit": "Hours"
                }
            ]
        }
    }

I've tried both the parent pipeline runid and the child pipeline runid in the URL and both return an empty Value array.

What am I missing?

Upvotes: 0

Views: 949

Answers (2)

Pratik Lad
Pratik Lad

Reputation: 8382

Agreed with @AnnuKumari to get activity run details the pipeline should be run with trigger does not debug mode faced same issue but when I triggered it I got an output. Also make sure that is right one and runs exist between the interval specified (UTC).

Also, as you want the activity run details of child pipeline activity. you need to provide its run id as @{activity('Execute Pipeline1').output.pipelineRunId}

Sample URL:

https://management.azure.com/subscriptions/@{pipeline().globalParameters.SubscriptionId}/resourceGroups/@{pipeline().globalParameters.ResourceGrpName}/providers/Microsoft.DataFactory/factories/@{pipeline().DataFactory}/pipelineruns/@{activity('Execute Pipeline1').output.pipelineRunId}/queryActivityRuns?api-version=2018-06-01

My execution:

enter image description here

Output:

enter image description here

Upvotes: 1

AnnuKumari
AnnuKumari

Reputation: 563

You need to make sure that the pipeline whose execution details you want to capture is executed via 'Trigger' mode and not 'Debug' mode. So , you need to publish and trigger the pipeline, capture the pipeline runid and pass the same in the web activity.

Upvotes: 1

Related Questions