0
votes

I set up a python code that will store a file in Blob storage. I want an email to be sent to me every time the file gets stored. I set up a recurrence followed by when a blob is added or modified. Then when it detects the file has been added it sends me an email. But when i upload a file to blob the logic app continuously sends emails till i disable it.

1

1 Answers

1
votes

You should get rid of the Recurrence trigger and modify the When a blob is added or modified trigger to check at frequency intervals (e.g. every 5 seconds). Here's what the code for your trigger could look like:

"When_a_blob_is_added_or_modified_(properties_only)": {
    "inputs": {
        "host": {
            "connection": {
                "name": "@parameters('$connections')['azureblob']['connectionId']"
            }
        },
        "method": "get",
        "path": "/datasets/default/triggers/batch/onupdatedfile",
        "queries": {
            "folderId": "/outagetesting",
            "maxFileCount": 1
        }
    },
    "recurrence": {
        "frequency": "Second",
        "interval": 5
    },
    "splitOn": "@triggerBody()",
    "type": "ApiConnection"
}

Rather than using a polling trigger, you should look into Azure Event Grid's Blob Created Event.