Storage Accounts with Data lake Storage gen2 enabled allows us to create directories within container.
When we use When a blob is added or modified (properties only) trigger. It works fine for destination where we are looking for blobs inside containers but not inside any directories.
For example:
Even though we choose the location of this directory for When a blob is added or modified (properties only) trigger. The trigger won’t get fired when new blob is created or modified inside directory.
To overcome this, we can use event grid trigger When a resource event occurs.
Make sure Microsoft.EventGrid is registered under resource providers in subscription.
This is webhook type trigger and it registers a webhook with the endpoint. In this case it will be a specified path inside container of a storage account.
For example:
/blobServices/default/containers/container1/blobs/folder1/
Note: the last forward slash ‘/’ after directory name is very important, otherwise you would not get the desired result.
Getting the content of those blobs:
For getting the content inside blobs we can use either HTTP action or get blob content (using path) action.
This is the data object returned after trigger got fired.
"data": {
"api": "PutBlob",
"clientRequestId": "clientRequestIdValue",
"requestId": "requestIdValue",
"eTag": "eTagValue",
"contentType": "text/plain",
"contentLength": 6,
"blobType": "BlockBlob",
"blobUrl": "https://storageAccountName.blob.core.windows.net/containerName/folderName/fileNameWithExtension",
"url": "https://storageAccountName.blob.core.windows.net/containerName/folderName/fileNameWithExtension",
"sequencer": "sequencerValue",
"storageDiagnostics": {
"batchId": "batchIdValue"
}
}
We can use either blobUrl or url element from data value to retrieve the path for getting blob content.
Expression Inside URI : triggerBody()?['data']?['blobUrl']
You can also use below expression to frame audience from url element of data object.
concat(split(triggerBody()?['data']?['url'],'net')[0],'net')
Expression inside Blob: split(triggerBody()?['data']?['blobUrl'],'.net/')[1]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.