In the earlier section, you have built a Logic App using the Azure portal. Now we will walk through developing Logic Apps using Visual Studio 2015. Logic Apps support a rich visual designer, and you can leverage the Visual Studio capability to build Logic App workflows. You can use Azure resource PowerShell scripts that ship with Logic Apps for automated deployment.
To start working with Logic App using Visual Studio 2015, there are certain prerequisites that need to be installed and configured properly:
Once you have Visual Studio 2015 and Azure SDK 2.9.1 or higher, you can follow the steps later to configure your Logic App template within Visual Studio.
On the Visual Studio designer surface, navigate to Tools | Extensions and Updates | Azure Logic Apps Tools for Visual Studio, and Click on the Download button to install the Logic App extension.
You can also use direct link: https://visualstudiogallery.msdn.microsoft.com/e25ad307-46cf-412e-8ba5-5b555d53d2d9 for Logic App extension download.
On Visual Studio, navigate to File | New Project | Cloud | Azure Resource Group. Type a name for the resource group and then click on OK.
From the list of templates, select Logic App, and this will create an empty Logic App project.
This will create an empty Logic App project in Visual Studio 2015; you will be able to see that the LogicApp.json
and Deploy-AzureResourceGroup.ps1
files have been added to the solution. The LogicApp.json
file will be using for workflow design, and Deploy-AzureResourceGroup.ps1
will be for the purposes of deployment.
The Logic App will poll twitter for new tweets with #SunnyElectricals and store all tweet information in the Azure SQL table. Here, twitter is acting as polling trigger and instantiates a runtime workflow with each single tweet message posted over tweeter. This is similar to what we have developed through Azure portal.
To open the Visual Studio designer for Logic App, right-click on the <template>.json
file, and click on Open With Logic App Designer. You need to select the correct Azure subscription, resource group, and location for the deployment template.
We then store all the tweet information in an Azure SQL table for further analysis purposes:
The overall solution structure will look like the figure mentioned later. You can download the solution from a GitHub repository and source code attached with the book.
You can go through code behind by navigating code view tab at the bottom of Visual Studio designer. This way, you can see trigger and action code associated with Logic App. If you look at the code behind for the earlier solution, you can find a trigger and associated action within Logic App code behind:
"When_a_new_tweet_is_posted"
. You can also verify the method type and recurrence polling interval for the Microsoft managed twitter API.
Insert
operation against SQL. The code behind will show the actual workflow logic for your logic App:Insert_row
post
"tweetBy": "@{triggerBody()['TweetedBy']}"
"tweetText": "@{triggerBody()['TweetText']}"
After creating Visual workflow associated with Logic App, you can right-click the solution and click on Deploy. This will prompt you to select proper Azure Resource Group and the plan.
Once deployment of Logic App is succeeded, log in to the Azure portal and verify the Logic app activity log and summary by clicking on the Overview section and Activity log section. Logic App activity log gives you better insight into resource group monitoring.
Logic App diagnostics will give overall analysis of workflow run. You can click on the Diagnostics section of Logic App blade to see the graphical representation of all the runs.