azure-data-factoryazure-blob-trigger

Set a variable from the contents of a JSON blob that triggered a data factory pipeline


I have a data factory pipeline that is triggered by a create blob trigger. I need to parse the blob (JSON) and set a variable from the blob content that can be used downstream in the pipeline.

I've tried using a lookup activity with the JSON Blob Dataset, but I can't seem to figure out how to set a variable from the JSON that can be used in the next lookup activity.

The sample JSON is:

{ "RUN_IDENTIFIER": "c46aca8d-012c-4db2-8abf-e784aeb52a0a" }

I need to get the value for the RUN_IDENTIFIER and set a variable.

Any ideas on how I can accomplish this?


Solution

  • For creating the Blob trigger and to get the triggered file name, you can go through this SO answer where you need to use lookup activity with the dataset.

    After setting the trigger parameters, uncheck the First row only in the lookup activity. As per your input JSON structure, take a string set variable activity after the lookup and use the below expression to get the required RUN_IDENTIFIER.

    @activity('Lookup1').output.value[0].RUN_IDENTIFIER
    

    enter image description here

    Upon the new JSON file creation or an existing JSON file modification, the pipeline will be triggered, and you will get the desired output in a variable as shown below.

    enter image description here