Use azure data factory management api POST and GET

Raj D 616 Reputation points
2021-12-07T21:50:02.547+00:00

Greetings!!!

I am using the ADF azure management api (https://management.azure.com/) to capture pipeline run information. When using the GET method in the web activity I get the below error.

GET: https://learn.microsoft.com/en-us/rest/api/datafactory/pipeline-runs/get

https://management.azure.com/subscriptions/@{variables('subscriptionid')}/resourceGroups/@{variables('resourcegroup')}/providers/Microsoft.DataFactory/factories/@{pipeline().DataFactory}/pipelineruns/@{pipeline().RunId}?api-version=2018-06-01

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

When using the POST method in the web activity I get no response in the value[].

POST: https://learn.microsoft.com/en-us/rest/api/datafactory/pipeline-runs/query-by-factory

https://management.azure.com/subscriptions/@{variables('subscriptionid')}/resourceGroups/@{variables('resourcegroup')}/providers/Microsoft.DataFactory/factories/@{pipeline().DataFactory}/queryPipelineRuns?api-version=2018-06-01

I'm using the below request body for the POST method.

{  
  "lastUpdatedAfter": "@{adddays(utcnow(),int(activity('pipelineactivity').output.firstRow.PropertyValue))}",  
  "lastUpdatedBefore": "@{utcnow()}",  
  "filters": [  
    {  
      "operand": "PipelineName",  
      "operator": "Equals",  
      "values": [  
        "@{pipeline().parameters.PipelineName}"  
      ]  
    }  
  ]  
}  

Thank you

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. svijay-MSFT 5,256 Reputation points Microsoft Employee Moderator
    2021-12-08T15:25:57.46+00:00

    Hello @Raj D ,

    Welcome to the Microsoft Q&A platform.

    As mentioned in the question. https://learn.microsoft.com/en-us/rest/api/datafactory/pipeline-runs/get , you are using the endpoint to query the pipeline.

    This will only query the non-debug pipeline runs - meaning triggered runs.

    I encountered the issue when I ran the pipeline using the Debug option

    155994-image.png

    And did not occur when in the prod/triggered run or simply when I click on the trigger now after publishing the latest changes. I was able to run the activity successfully.

    155939-image.png

    If this is not your case, you can choose ignore the below answer and help me understand whether issue is persistent even in client tools like POSTMAN.

    If you want to get the data for the current debug pipeline run. From my testing you will have to tweak your endpoint slightly to query the debug runs.

    Just a minor change ........<FACTORYNAME>/debugpipelineruns..... instead of ......<FACTORYNAME>/pipelineruns.....

    https://management.azure.com/subscriptions/<YOUR SUBSCRIPTION>/resourceGroups/<RESOURCE GROUP>/providers/Microsoft.DataFactory/factories/<FACTORYNAME>/debugpipelineruns/@{pipeline().RunId}?api-version=2018-06-01  
    

    Method : GET

    Output:

    155954-image.png

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators
    1 person found this answer helpful.

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.