Logic app to retrieve the latest file from a blob folder

Aditya Singh 105 Reputation points
2024-04-01T14:00:18+00:00

How can I create a logic app that retrieves the latest file from a blob folder when a Http request is received, where there are multiple files, and sends it as an attachment? Are there any specific steps or configurations required for this process?

Azure Data Lake Storage
Azure Data Lake Storage
An Azure service that provides an enterprise-wide hyper-scale repository for big data analytic workloads and is integrated with Azure Blob Storage.
1,354 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,447 questions
Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,867 questions
Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
4,417 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,640 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Iliev-MSFT 6 Reputation points Microsoft Employee
    2024-04-17T07:23:23.99+00:00

    Hello,

    Thank you for raising the post.

    To create a logic app that retrieves the latest file from a blob folder when a Http request is received, where there are multiple files, and sends it as an attachment, you can follow these steps:

    1. Create a new logic app in the Azure portal.
    2. Add a "When a HTTP request is received" trigger to your logic app.
    3. Add a "List blobs" action to your logic app, and configure it to list the blobs in the desired container and folder.
    4. Add a "Filter array" action to your logic app, and configure it to filter the blobs to only include the ones that match your desired criteria (e.g. only include blobs with a certain prefix or extension).
    5. Add a "Sort array" action to your logic app, and configure it to sort the filtered blobs by their "Last Modified" property in descending order.
    6. Add a "Get blob content" action to your logic app, and configure it to get the content of the first blob in the sorted array (which should be the latest one).
    7. Add a "Create HTML table" action to your logic app, and configure it to create an HTML table that includes the name and URL of the latest blob. 8. Add a "Send an email" action to your logic app, and configure it to send an email with the HTML table as an attachment.

    These are the general steps you can follow to create a logic app that retrieves the latest file from a blob folder when a Http request is received, where there are multiple files, and sends it as an attachment.
    However, the specific configurations required for each action may vary depending on your specific scenario.

    Hope it helps.

    1 person found this answer helpful.
    0 comments No comments

  2. Dillon Silzer 54,731 Reputation points
    2024-04-02T04:09:07.24+00:00

    Hi Aditya,

    If I am reading this correctly, you are looking to check if a new blob is added (a trigger). Please see the following documentation:

    Add a Blob trigger

    https://learn.microsoft.com/en-us/azure/connectors/connectors-create-api-azureblobstorage?tabs=standard#add-a-blob-trigger

    When going through the steps, you can see what types of tasks you can use:

    User's image

    Then Add an Action:

    https://learn.microsoft.com/en-us/azure/connectors/connectors-create-api-azureblobstorage?tabs=standard#add-a-blob-action

    Hopefully this helps.

    If this is helpful please accept answer.