Integrating Azure Storage Blob With MuleSoft
Author: Rahul Dusaje
Microsoft Azure: Azure is a public cloud computing platform that offers Infrastructure as a Service (IaaS), Platform as a Service (PaaS), and Software as a Service (SaaS) solutions that may be used for analytics, virtual computing, storage, networking, and other services.
Blob: Binary Large Object — Blob is capable of storing unstructured data which can be text, binary, audio, etc.
Azure Storage is used for Data Storage on Cloud which can be utilized for the following use-cases:
- Writing Log files on the Azure Storage.
- Storing data for backup and restore, disaster recovery, and archiving.
- Storing data for analysis by an on-premises or Azure-hosted service.
- Saving images or documents directly to a browser.
In this use-case, we will create Resource Group, Storage Account and a container to upload the blob(a json file, here) and perform the following operations on it using MuleSoft:
- List Blobs in Container
- Download Blob
- Delete Blob
- Upload Blob
- Microsoft Azure Account( Enterprise or Student Version)
- Microsoft Azure Storage Connector.
- Anypoint Studio.
1) Creating a Resource Group.
A resource group is a logical container that associates multiple resources so that they may be managed as a single entity — both in terms of lifecycle and security.
- Goto Home-> Resource Groups -> Create.
- Name the Resource Group and select the region.
- Click Review and Create.
2) Create a Storage Account.
An Azure storage account holds all of your Azure Storage data objects, such as blobs, file shares, queues, tables, and discs. Data in your storage account is highly available, secure, and enormously scalable.
- Goto Home -> Storage Accounts -> Create
- In the Project Details, provide the Resource Group(created in the previous step) for the Storage Account.
- In the Instance Details, provide the Storage Account Name, Region, Performance(Standard or Premium) and Data Storage Redundancy (Geo Redundant Storage is used in our use-case).
- Review + create.
For knowing the suitable Data Storage Redundancy methods, visit here.
3) Create a Container within a Storage Account.
- Goto Storage Accounts -> (your_storage_account) -> Containers -> Create.
- Provide the Name and Select Public Access Level as Blob.
4) MuleSoft Configurations:
- Download the Azure Storage Connector from Exchange.
- Note the Storage Account Name and Connection String( in Storage Account -> Access Keys -> Connection String).
5) MuleSoft Application:
- Create a scheduler based application.
- It gets the list of all the blobs from a container using List blobs in the container connector.
- If there exists any blob, it downloads it and deletes it using Download blob and Delete blob connectors respectively, otherwise.
- It creates a new blob within the specified container using the Upload blob connector.
In Set Payload, a json structured data is uploaded as a blob.
Blob in Azure Storage: