Integrating Azure Storage Blob With MuleSoft

Apisero
3 min readJun 27, 2022

--

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:

  1. Writing Log files on the Azure Storage.
  2. Storing data for backup and restore, disaster recovery, and archiving.
  3. Storing data for analysis by an on-premises or Azure-hosted service.
  4. 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:

  1. List Blobs in Container
  2. Download Blob
  3. Delete Blob
  4. Upload Blob

Pre-Requisites:

  1. Microsoft Azure Account( Enterprise or Student Version)
  2. Microsoft Azure Storage Connector.
  3. Anypoint Studio.

STEPS:

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.

  1. Goto Home-> Resource Groups -> Create.
  2. Name the Resource Group and select the region.
  3. 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.

  1. Goto Home -> Storage Accounts -> Create
  2. In the Project Details, provide the Resource Group(created in the previous step) for the Storage Account.
  3. 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).
  4. Review + create.

For knowing the suitable Data Storage Redundancy methods, visit here.

3) Create a Container within a Storage Account.

  1. Goto Storage Accounts -> (your_storage_account) -> Containers -> Create.
  2. Provide the Name and Select Public Access Level as Blob.
  3. Create

4) MuleSoft Configurations:

  1. Download the Azure Storage Connector from Exchange.
  2. Note the Storage Account Name and Connection String( in Storage Account -> Access Keys -> Connection String).

5) MuleSoft Application:

  1. Create a scheduler based application.
  2. It gets the list of all the blobs from a container using List blobs in the container connector.
  3. If there exists any blob, it downloads it and deletes it using Download blob and Delete blob connectors respectively, otherwise.
  4. It creates a new blob within the specified container using the Upload blob connector.

NOTE:

In Set Payload, a json structured data is uploaded as a blob.

Blob in Azure Storage:

--

--