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

johananmahendran 40 Reputation points


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.


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

Accepted answer
  1. MikeUrnun 6,841 Reputation points

    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