Using Azure Logic App to store email attachments into a storage account.
In this blog we are going to see how we can process email attachments using Azure Logic App and to store these attachments as blobs in containers of a storage account.
- Create a Storage Account
Create a storage account with type Blob Storage in Azure.
- Create a container inside the storage account with public access level anonymous.
- Create the Logic App
- Open the Logic App Designer and choose the Blank Logic App Template
- Search “outlook” in the search for connectors and actions search box. Select the trigger- When a new email arrives (V3)
- Configure Yes for the parameters “Only with Attachments” and “Include Attachments”. Also configure the email connection to an outlook email id.
- Click New Step and search for blob in the connectors and actions search box. Select the action – Create blob
- Establish the connection to the storage account that was created earlier. Navigate to the attachments contains that was created earlier along with Storage account. You can give the blob name as the Attachments name and blob content as the Attachments content.
- Save the Logic App and Run it
Now to test the logic app, you must send an email with attachments to the email id which you have configured in Step 6.
Once the Logic App is executed, you will see a similar screen like the below
If you check the storage account / container (attachment), you will see the ermail attachments are stored as blobs in the container.
As you can see we didn’t have to do any programming or wrote even a single line of code to achieve this functionality. By extending this functionality you can use this in real world applications.