Introduction

Azure Storage connector allows user to make use of Azure Storage services using Microsoft Azure Storage SDK for Java.

Microsoft’s Azure Storage is the cloud storage solution for modern applications that rely on durability, availability, and scalability to meet the needs of their customers.

Read through this user guide to understand how to set up and configure a basic flow using the connector. Track feature additions, compatibility, limitations and API version updates with each release of the connector using the Connector Release Notes. Review the connector operations and functionality using the Technical Reference alongside the demo application.

MuleSoft maintains this connector under the Enterprise IT support policy.

Prerequisites

This document assumes that you are familiar with Mule, Anypoint Connectors, and Anypoint Studio Essentials. To increase your familiarity with Studio, consider completing a Anypoint Studio Tutorial. This page requires some basic knowledge of Mule Concepts, Elements in a Mule Flow, and Global Elements.

Software Requirements

  1. Anypoint Studio with Mule Runtime 3.x

  2. Azure Storage Connector 1.2.0

Compatibility

Azure Storage connector supports Mule 3.x version.

Installing the Connector

You can install the connector in Anypoint Studio using the instructions in Installing a Connector from Anypoint Exchange.

Installation guide is also available here

Upgrading from an Older Version

Since this is the first version of Azure Storage Connector, upgrading from older version is not applicable.

Configuring the Connector Global Element

To use the Anypoint Azure Storage connector in your Mule application, you must configure a global element that can be used by the Anypoint Azure Storage connector (read more about Global Elements). The Azure Storage connector offers the following global configuration(s), requiring the following credentials: Storage Account Name and Key.

Field Description

Key

Enter the Key to log into Azure Storage account.

Storage account name

Enter the Storage Account Name.

Using the Connector

The below list of operations can be performed by using Azure Storage Connector.

Operation

Description

Inbound

Outbound

Download Blob

Downloads the Blob from the container.

container, File Name

Inputstream of Blob.

List All Containers

Gets list of all containers.

No input required.

List of all Blob containers.

Create Container

Creates a Blob container.

Container Name

True for successful creation, False for failure.

List Blobs In Container

Gets the list of Blobs in a container

Container Name

List of Blob items.

Upload Blob

Uploads the Blob into the storage.

Container, File Name, File inputstream

True for successful upload, False for failure.

Upload Blob From Path

Uploads the Blob into the storage from a file path.

Container, File Name, File path

True for successful upload, False for failure.

Delete Blob

Deletes the Blob in the storage account

Container, File Name

True for successful deletion, False for failure.

Delete Container

Deletes container from the storage account.

Container Name

True for successful deletion, False for failure.

Create Queue

Creates Queue in the storage account

Queue Name

True for successful creation, False for failure.

Add Message To Queue

Uploads message to the Queue.

Queue Name, Message

True for successful upload, False for failure.

Peek Message From Queue

Peek at the message in the front of a queue without removing it from the queue.

Queue Name

Message.

Update Message

Updates the contents of a queued message

Queue Name, Old message, New message

True for successful update, False for failure.

Get Queue Length

Gets the length of the Queue.

Queue Name

Length of Queue.

Dequeue Message

Retrieves single message from the Queue.

Queue Name

Message

Dequeue Messages

Gets list of messages from the Queue

Queue Name, Number Of Messages

List of Messages.

Get List Of Queues

Gets list of Queues in the storage account

No input required

List of Queues.

Delete Queue

Deletes the Queue

Queue Name

True for successful deletion, False for failure.

Create Table

Creates a Table in the storage account

Table Name

True for successful creation, False for failure.

List Table

Gets list of Tables in the storage account

No input required

List of Tables.

Add Entity

Adds entity to the table

Table Name, Partition Key,Row Key, properties

Table Result.

Get Single Entity

Retrieves single entity of the table

Table Name, Partition key, Row key

Table Entity

Update Entity

Updates entity in the given table

Table Name,Partition Key,RowKey, properties

Table Result

Delete Entity

Deletes the entity from the table

Table Name, Partition Key, Row Key

True for successful deletion, False for failure.

Delete Table

Deletes the table from the storage account

Table Name

True for successful deletion, False for failure.

Create Share

Creates Share in the storage account

Share Name

True for successful creation, False for failure.

Get Share

Gets Share details

Share Name

File Share

Upload File In Directory

Uploads file in directory

File Path, Share Name, Directory Name

True for successful updload, False for failure.

Upload File In Root Directory

Uploads file in root directory

File Path, Share Name

True for successful upload, False for failure.

Upload File In Directory With Stream

ploads a file input stream to the specified directory of a share

File Stream, File Name, Share Name, Directory Name

True for successful upload, False for failure.

Upload File In Root Directory With Stream

Uploads a file input stream to the specified directory of a share

File Stream, File Name, Share Name

True for successful upload, False for failure.

Create Directory

Create directory in the Share

Directory Name, Share Name

True for successful creation, False for failure.

Lst Files and Dir in Share

Gets the list of Files and Directories

Share Name

List of File items

List Files and Dir In Directory

Gets the list of Files and Directories

Share Name, Directory Name

List of File items

Download File

Downloads the file from the directory

File Name, Directory Name, Share Name

File inputstream

Download File From Root Dir

Downloads the file from root directory

File Name, Share Name

File text

Delete File

Deletes file from the directory

File Name, Directory Name, Share Name

True for successful deletion, False for failure

Delete Directory

Deletes the directory from the Share

Directory Name, Share Name

True for successful deletion, False for failure

Delete Share

Deletes the Share from the storage account

Share Name

True for successful deletion, False for failure

Connector Namespace and Schema

When designing your application in Studio, the act of dragging the connector from the palette onto the Anypoint Studio canvas should automatically populate the XML code with the connector namespace and schema location.

Tip
If you are manually coding the Mule application in Studio’s XML editor or other text editor, define the namespace and schema location in the header of your Configuration XML, inside the <mule> tag.
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/azure-storage-service http://www.mulesoft.org/schema/mule/azure-storage-service/current/mule-azure-storage-service.xsd

      <!-- put your global configuration elements and flows here -->

</mule>

Using the Connector in a Mavenized Mule App

If you are coding a Mavenized Mule application, this XML snippet must be included in your pom.xml file.

    	<dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>azure-storage-connector</artifactId>
            <version>1.2.0</version>
        </dependency>

Demo Mule Applications Using Connector

You can download fully functional demo applications using the Azure Storage connector from this link

Example Use Case

The current use case describes how to create a Mule application to upload Blob into Azure Storage account.

  • Create a new Mule Project in Anypoint Studio.

  • Set Azure Storage account credentials in src/main/resources/mule-app.properties.

  • Copy the api.raml file in src/main/api folder, which is availble in the azure-storage-demo application.

  • Generate Flows from REST Api.

  • Drag and drop the Azure storage connector from Mule palette.

  • Click Test Connection to confirm that Mule can connect with the instance. If the connection is successful, click OK to save the configuration. Otherwise, review or correct any invalid parameters and test again.

  • Paste the below XML in the generated Mule Flow.

  • Deploy the application and check "DEPLOYED" on the console.

  • Browse the URL: http://localhost:8081/console

  • Click the Upload button and enter the input values.

  • Submit the values and verify the results.

Example Use Case - XML

Paste this into Anypoint Studio to interact with the example use case application discussed in this guide.

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:azure-storage-service="http://www.mulesoft.org/schema/mule/azure-storage-service" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
	xmlns:spring="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/azure-storage-service http://www.mulesoft.org/schema/mule/azure-storage-service/current/mule-azure-storage-service.xsd">
    <http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
    <file:connector name="File" autoDelete="true" streaming="true" validateConnections="true" doc:name="File"/>
    <azure-storage-service:config name="Azure_Storage_Service__Azure_Configuration" accountName="storagemulepoc" accountKey="nWvEiM1KoJkZNJbmKujFQ2h+8DcSZsm4XYAXJOXsW++ONxn0deh9doE+1EZomQ3+hb9Qf4hB1mXsCpb3W88gsw==" doc:name="Azure Storage Service: Azure Configuration"/>
    <flow name="azure-storage-demoFlow">
        <http:listener config-ref="HTTP_Listener_Configuration" path="/" doc:name="HTTP"/>
        <file:outbound-endpoint path="C:\temp" connector-ref="File" responseTimeout="10000" doc:name="File"/>
        <azure-storage-service:upload-blob-from-path config-ref="Azure_Storage_Service__Azure_Configuration" container="firstcontainer" fileName="test.txt" path="c:\test.txt" doc:name="Azure Storage Service"/>
        <logger level="INFO" doc:name="Logger"/>
    </flow>
</mule>

Resources