Using Azure Function with Event Grid Trigger to monitor and chunk Blob storage uploads.

johananmahendran 115 Reputation points
2023-08-28T15:04:48.9766667+00:00

Hi,

I am interested in augmenting uploads to a Blob storage container in the following way:

  1. Detect the file type of the file. If it is a docx or xlsx file, then convert them to pdf before upload.
  2. When a pdf file is uploaded (included the ones that were freshly converted), detect the size of the file. If it is greater than or equal 16MB chunk, then chunk the pdf files into chunks of size 16MB or less.
  3. Upload each chunk into the Blob storage container (or to an alternative Blob storage container.)

The ultimate goal is to have these chunks indexed to Cognitive Search and used in a Retrieval Augmented Generation pattern.

I was interested in using Azure Functions to detect changes to the Blob storage and perform the processing as necessary. Because my database is quite large, I am plan on using Event Grid triggers as I've read that it offers high-scalability with lower latency than blob trigger.

However, I can't seem to find resources or example code on how to use Event Grid to detect changes in my Blob storage. I am still fairly new to Azure Functions (only started within the last two days). May I have guidance on this matter? Please provide what output is expected if possible.

I am using VS Code for my testing and deployment of Azure Function app.

Thanks!

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,461 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,528 questions
Azure Event Grid
Azure Event Grid
An Azure event routing service designed for high availability, consistent performance, and dynamic scale.
330 questions
0 comments No comments
{count} votes

Accepted answer
  1. Mike Urnun 9,771 Reputation points Microsoft Employee
    2023-08-29T02:51:17.84+00:00

    Hello, @johananmahendran - Welcome to Azure, and thanks for reaching out!

    You're on the right path by going with the Event Grid trigger, and here's how I would break down the workflow:

    Additionally, I would also consider Logic Apps for this type of workflow as it might provide quicker time-to-solution using a declarative, designer-first development approach.

    0 comments No comments

0 additional answers

Sort by: Most helpful