In this article we will implement a Azure Function utilizing Azure Queue storage that will post a message to the queue. The sample code for this article can be obtained from GitHub

For development purposes using Visual Studio IDE ensure that Azure Storage emulator is installed and be obtained from here . Once installed the executable can be located in the following path:

Starting the emulator can be done through command window:

Choosing Show Storage Emulator UI option will bring up the following and lists the commands that can be used

The Storage Emulator uses a local Microsoft SQL Server 2012 Express LocalDB instance to emulate Azure storage services. In the example scenario we will build a Azure Function to post a message to the Queue Storage. The data model we will use in the sample is as per below:

A snippet of the code to post a message to the queue is as below:

Testing and Validation:

Now that we have implemented “ApplyForLoan” function let us test and validate to ensure that the request message is successfully posted to the “loan Application” queue and explore the contents of the message in queue using Microsoft Azure Storage Explorer. Details on how to inspect the message posted to the queue is detailed later part of the article. List of Function names displayed in console

Using Postman invoke the ApplyForLoan function

Code debug view
If the message is successfully posted to the Queue then it can be viewed from Azure Storage Explorer
Tool(s) to explore Azure Storage Emulator Resources:

There are two options available for exploring the items in the Azure Storage Emulator.

  1. From within Visual Studio choose the Cloud Explorer

This will list Blob Containers, Queues, Tables attached to the storage account

2. The second option is Azure Storage Explorer and can be downloaded from here once installed connect to the Local storage by clicking on Add Connection

Choose Next and then Connect

Once successfully connected the view will be refreshed with the newly added connection

Note: Issues with Azure Storage Explorer

If there is an error in as shown below:

Then ensure that Storage Emulator is started

Then restart Azure Storage Explorer the error should now disappear