I'm new to Azure Data Factory and have a requirement that sounds pretty simple but I not able to figure it out.
I have a Json file saved in a storage acount container, from which i need to read the value of "LastRunDate" (pretty easy).
{
"LastRunDate": "2024-01-12"
}
The problem is, there is a senarion where this file might not exist. If the file does not exist while trying to read it, i need to create the file on the fly and write the below default json to it.
{
"LastRunDate": "2000-01-01"
}
My approach was to use the "Get MetaData" Activity and use the metadata "exist" to find out if the file exist or not - which was fine. My thought then was to assign a variable (with the default Json string) and write the value of the variable to the new file. This is the point where i hit a brick wall. Im not able to create the json file on the fly with a default value.
NOTE: Not in the position to create any dummy files upfront to copy from. The file has to be created on the fly.







The simplest solution:
Create the default file manually in a different folder on the storage account (once)
In your pipeline: