How to get a callback or a notification from azure to my api endpoint when i upload a blob to a storage account ?

Sahil Kumar 0 Reputation points
2024-11-27T10:04:08.8733333+00:00

I want to get a azure callback for which i have created a call-back api in my server side when a client uploads a blob to a storage account i want to get a status saying it has been uploaded to azure on the server side . Could you please suggest me the steps or valid documentation for this !!!

Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
3,003 questions
Azure Event Grid
Azure Event Grid
An Azure event routing service designed for high availability, consistent performance, and dynamic scale.
407 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Deepanshu katara 12,555 Reputation points
    2024-11-27T15:26:32.9933333+00:00

    Hello Sahil , Welcome to MS Q&A

    I think you can use Azure Event Grid. By subscribing to Blob storage events, you can set up a system that sends notifications to your application whenever a blob is created or modified. Here’s how you can do it:

    1. Create a Blob Storage Account: First, ensure you have a Blob storage account set up in Azure.
    2. Subscribe to Events: Navigate to your storage account in the Azure portal, select "Events" from the left menu, and create an event subscription. You will need to specify the endpoint where the events should be sent, such as a web app or an Azure Function.
    3. Trigger an Event: When a blob is uploaded to the storage account, Event Grid will send an event to the specified endpoint, allowing your application to react accordingly.

    This setup allows you to handle events asynchronously without the need for polling, making your application more efficient.

    References:

    Please let us know if any more explanation needed

    Kindly accept answer if it helps

    Thanks

    Deepanshu

    0 comments No comments

  2. Keshavulu Dasari 2,420 Reputation points Microsoft Vendor
    2024-11-27T16:56:06.25+00:00

    Hi Sahil Kumar ,
    Welcome to Microsoft Q&A Forum. Thanks for posting you query here!
    To get a callback or notification from Azure when a blob is uploaded to a storage account, you can use Azure Event Grid. Here are the steps to set it up:

    1. Create an Azure Storage Account: If you don't already have one, create a storage account in the Azure portal.
    2. Enable Event Grid on the Storage Account:
      • Go to your storage account in the Azure portal.
      • Under the "Events" section, select "Event Grid".
      • Click on "Create Event Subscription".
    3. Create an Event Subscription:
      • In the "Create Event Subscription" pane, provide the necessary details:
      • Name: Give your event subscription a name.
      • Event Schema: Choose "Event Grid Schema".
      • Event Types: Select the event types you want to subscribe to (e.g., BlobCreated).
      • Endpoint Type: Choose "Web Hook".
      • Endpoint: Enter the URL of your API endpoint that will handle the callback.
    4. Configure Your API Endpoint:
      • Ensure your API endpoint is set up to receive and process the events from Event Grid.
      • Your endpoint should be able to handle HTTP POST requests and process the event data sent by Event Grid.

    Upload a blob to your storage account and verify that your API endpoint receives the event notification.


    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members. 
    User's image

    If you have any other questions or are still running into more issues, let me know in the "comments" and I would be happy to help you


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.