Overview
In a previous article, we have seen the details of Azure functions and saw how they expose a gateway to achieve almost everything in Azure whenever it comes to event driven programing.
In this article, we will be going through one such scenario which integrates two great offerings of Azure which are Azure functions and logic Apps.
This article assumes that you know basics of Azure functions and logic apps. If not, it’s highly advisable that you should learn details of both offerings by visiting links below,
Scenario
We will create a simple Azure function using our favorite language, C#, which will be responsible for writing entries in Azure storage.
As we have seen, Azure functions can be executed whenever any event occurs, meaning that we will need some kind of trigger to execute our function which we are about to create. Now either I create that trigger manually or if I can automatically generate it based on any particular event, t is where Logic app comes to the rescue.
We will be leveraging Azure logic app to generate that trigger for us. Azure logic app offers lots of inbuilt triggers e.g. Manual trigger, recurring, external event based trigger e.g. Item is added in SharePoint list etc.
I always enjoy working with Azure and have implemented a good amount of solutions using Azure for multiple customers.
Though Azure offers lots of health check offerings for solutions hosted on Azure which can effectively cater to customer’s service HA requirement, however, for developers or IT admins it becomes tricky to know if any particular Azure offering is facing some outage in a particular region unless we visit Azure status website i.e. https://status.azure.com
No doubt that, it is a wonderful website providing all required information about current status of all Azure services and in all regions but one has to monitor it.
In this example, what we want to do is that we want to automate this process of monitoring Azure status so that we are immediately notified whenever any event occurs in Azure status web site and just for sake of integrating azure storage in this example, we will maintain a record of all the services which faced downtime inside an Azure table storage.
We will be using Logic app’s RSS Feed trigger event and point it to scan the RSS feed of status.azure.com website and generate an event based on feed changes.
Implementation
So let’s start by creating Azure Logic app – It is a quite straightforward process.
Since we will be working with a new Azure portal and all our resources will be created in ARM mode let’s create a Resource Group in Southeast Asia region before creating anything else. We will name our resource group as ‘IntegrationRG’ and logic app as ‘IntegrationApp’

Once the logic app is created, let’s navigate to it and click on Edit from top.
We will be presentedwith a Logic App designer with a number of templates to get started but we will choose blank and start customizing it from there.
Designer shows the list of Microsoft managed APIs, essentially different available triggers to choose from. We will choose the RSS trigger from the list.
As mentioned in the description of trigger API, it will trigger an event whenever a new item is published in any RSS feed.

Once the trigger action is added, let’s configure it and point it to periodically scan the status.azure.com RSS feed.

Click on RSS feed icon to get RSS feed and note it.

Enter the RSS feed in the Feed URL input of trigger and keep poll frequency as 10 minutes.
Once this is done, we want to invoke our Azure function and add it as next action here in this editor so that response from the feed can be sent to our Azure function which will store it in Azure table storage.
Save your changes in logic app editor by clicking save icon and exiting from it.
Now we need two things. First, an Azure storage and second the Azure function.
Let’s create both. To keep this article short, let’s not dive deep into the process of creating storage and azure function using Azure portal.
We will name storage account as ‘statusstorage’ and azure function app as ‘integrationapps’.
Once the function app is provisioned, we will create a new function and will name it as ‘StatusWriter’.
Note that, in order to make sure that this function would appear in Logic apps editor we will need to create it using Generic Webhook C# Template.

Once the function is created, let’s navigate to it and browse to integrate part where we will be able to set the input and output of this function.
As we want this function to write entries in the Azure table storage, let’s select the output as table storage and select correct storage account i.e. ‘statusstorage’

In the next step, let’s do the binding of parameters and select correct storage account in which storage table will be created if it does not exist.

If you do not see your storage account in the dropdown, then simply create a new connection to your storage account by clicking new button. All it does is, adds connection string entry in your function app’s application settings file.
Click on save and browse to the develop tab.
As this azure function will be interacting with table storage using Azure storage APIs so we would need to add the reference of Microsoft.WindowsAzure.Storage and also mention using statement as shown below

Next, let’s decide the schema of AzureStatus storage table. Process remains the same i.e. typically we define a class inheriting from TableEntity class so let’s add our AzureStatus class at bottom of editor

Once we have schema class ready, let’s modify bindings of the main ‘Run’ function.









Nikhil DhandePosted Dec 21, 2017, 6:35 AM
Thanks Bhushan. This article really helped me to find a solution for the problem I was working on.
kathiravan.k kathirPosted Apr 13, 2017, 4:01 AM
Logic app webhook response waiting for a long time
Bhushan GawalePosted Mar 7, 2017, 2:08 AM
Sorry for the delay in response Ravi but great that you found the solution and thanks for sharing it with community! Cheers!