I have function app pointing to azure storage using BlobTrigger.
[FunctionName("ProcessFiles")]
public async Task Run([BlobTrigger("container-path/{name}", Connection = "myconnection")] Stream myBlob, string name, ILogger log)
{
//Processing Logic here
}
I also have set up LifeCycle management policy, where in files residing for > 3 months in Container will be auto deleted.
{
"rules": [
{
"enabled": false,
"name": "Delete 1 day or older",
"type": "Lifecycle",
"definition": {
"actions": {
"baseBlob": {
"delete": {
"daysAfterModificationGreaterThan": 1
}
}
},
"filters": {
"blobTypes": [
"blockBlob"
]
}
}
}
]
}
Now the issue is after every 1 day, when the file is being deleted, the BlobTrigger is being fired again and as a result the file is being processed again.
If I disable the LifeCycleManagement Policy, the issue does not occur. However, what I need is to process the function app logic only when a new file is being 'added' and not when 'deleted'.
The solution is already in production and can't change the BlobStorage Trigger as such so am hoping to use some property internally to detect if this is an add action and proceed accordingly.
Any workaround ideas please?