DEV Community

Cover image for Steps to Create a Consumption workflow in Azure logic app resource
joseph4real
joseph4real

Posted on

Steps to Create a Consumption workflow in Azure logic app resource

In this blog, I will be discussing how to create an automated workflow that combine two services: an RSS feed and an email account.

I will describe Server-less in Azure, Azure Function App Vs. Logic App, RSS Connector and RSS Feed.

Server-less in Azure: Based on Azure Documentation, server-less computing enables cloud developers to build applications faster by eliminating the need for them to manage infrastructure. It shifts developers focus towards writing and executing code, relieving them from the responsibility of managing the underlying infrastructure. Though Servers are still running the code, The serverl-ness name comes from the fact that the tasks associated with infrastructure provisioning and management are invisible to the developer.

Difference Between Logic App and Azure functions
Azure Function: Azure Functions is a serverless compute service that allows you to execute small code or functions in response to various triggers or events, examples are HTTP requests, timers, messages from queues, events from event hubs, etc. You write and deploy your code and Azure takes care of scaling and managing the infrastructure required to run your functions.

Logic Apps: Azure Logic Apps are serverless workflow and orchestration tools. It enables one to create and automate workflows and business processes by connecting various services, connectors, systems, and applications. Logic Apps provide a designer toolbar to build workflows using a wide range of connectors and actions, allowing you to focus on defining the logic and integration without worrying about the infrastructure.

RSS Connector: RSS stands for "Really Simple Syndication." It's a technology that allows websites to distribute their content in a standardized format. An RSS connector acts as a link between the website and you the reader. When you subscribe to an RSS feed of a website using an RSS connector, the connector keeps an eye on that website for you. It constantly checks for any updates or new content. When the website publishes something new, the RSS connector immediately notifies you.

RSS Feed: An RSS feed is an online file that contains details about every piece of content a website has published. Each time a site publishes a new piece of content, details about that content—including the full-text of the content or a summary, publication date, author, link, etc.—are automatically generated in the file and displayed in reverse chronological order. It's an easy way to stay up to date with your favourite websites, such as blogs or online magazines.

Creating Consumption Logic App Workflow
In this demo, I will use the RSS connector and the Microsoft Outlook connector. The RSS connector provides a trigger that checks an RSS feed, based on the specified schedule. The Microsoft Outlook connector provides an action that sends an email for each new item.

a. Sign into azure portal.
b. In the search box, search for logic app, and click logic app.

Image description

c. On the Logic app page, click add. On the create logic app page, adopt the below project details as specified in the following “Logic app page”: the subscription name, resource group, logic app name, region. Make sure you enable log analytics.

Image description
NOTE
Type of plans
Standard: This is a logic app resource plan, its the default selection and supports multiple workflows. These workflows run in single-tenant Azure Logic Apps and use the Standard billing model. Best for enterprise-level, serverless applications, with event-based scaling and networking isolation.

Consumption: This logic app resource type is the alternative selection and supports only a single workflow. This workflow runs in multi-tenant Azure Logic Apps and uses the Consumption billing model. Best for entry-level. Pay only as much as your workflow runs.

Zone Redundance is not highlighted because the region I choose does not support availability zone.
Enable log analytics is “No” because Im not enabling diagnostic logging. It appears only when consumption is selected.

d. Click Review + Create, after validation is passed, select Create.
e. After successive deployment, select go to resource, and select your logic app resource.

Image description

Selecting the Template
a. The my logic app Coms comes with various common designer triggers, but I will be choosing a blank template. Under template select Blank Logic App.

Image description
b. Shows template with empty workflow.

Image description

Add a trigger
A workflow always starts with a single trigger, which specifies the condition to meet before running any subsequent actions in the workflow. Each time the trigger fires, Azure Logic Apps creates and runs a workflow instance. If the trigger doesn't fire, no workflow instance is created or run. Azure Logic Apps includes hundreds of connectors with triggers that you can use to start your workflow.

I will be using an _RSS trigger _that checks an RSS feed, based on the specified schedule. If a new item exists in the feed, the trigger fires, and a new workflow instance is created and run. If multiple new items exist between checks, the trigger fires for each item, and a separate new workflow instance runs for each item. By default, workflow instances created at the same time also run at the same time, or concurrently.
a. Select All, search for RSS in the search box, from the trigger list select RSS trigger name When a feed item is published.

Image description
Get an RSS URL
I will be fetching my rss in The Wall Street Journal url from the web browser.
a)Right-click on the page and click on "view page source"

Image description
b. Once the source code opens press Cont F to search for rss, then copy the rss feed to your the RSS feed URL below.

Image description
c. Go with the following information in the RSS trigger below shown in yellow.

Image description

d. Save your workflow and Collapse the details window of the trigger info, by clicking the arrow point below.

Image description
Add an Action
The trigger above only checks the RSS feed without taking any action. I will be adding an action that will run whenever something is triggered.
An action is any subsequent step that runs some operation in the workflow, action can use the output from the previous step to trigger the next or another action. Many different action can be choosing, including multiple action up to what the limit per workflow.
Here I will use Office 365 Outlook action the sends a mail each time thet the trigger is fires for a new RSS feed item.
a. Select + New step under the When a feed item is published trigger.

Image description
b. Search for send a mail in the search box, and select Office 365 Outlook, if you have a personal account, select Outlook.com. Here I went with outlook.

Image description
Note: If you use a different supported email service in your workflow, the user interface might look slightly different.
c. After selecting Office 365, the Actions statement send an email comes up, then select it.

Image description
d. You will be prompted to sign in and authenticate your identity.

Image description
e. Accept the permission settings.

Image description
NOTE: Many connectors require you first create a connection and authentication before you continue, but this demo example uses login authentication for connecting to Office 365. Moreover, other types of services might support, use different authentication types. Based on the scenario, you can handle connection authentication in various ways.

f. This window Send an email action comes up after you signed in, please specify the following information in the mail.
To box: enter the receiver email address (joseph4real4u@live.com
Subject box: enter email subject (News RSS Item) and
Click Add dynamic content list, to select Feed title.

Image description

The Feed title is a trigger output that reference the title for the RSS item, your email uses this output to show the RSS item title. If no outputs appear from When a feed item is published trigger, please click see more.
g. The email subject capture looks like this below when you are done.
Image description
NOTE: a for each loop that appear on the designer, the designer automatically added the loop around the action that reference the output, to remove it click the three dots and delete.

Image description

h. Enter your email content in the body as shown below:
Type Title in the body with a space click on add dynamic content and select Feed Title. Do same for Date published and Link.

Image description
i. Once done click save.

Image description

Run your workflow
To check that the workflow runs correctly, you can wait for the trigger to check the RSS feed based on the specified schedule. Or you can manually run the workflow from the designer toolbar.
a. Click on the Run Trigger on the designer toolbar.

Image description
b. If My logic app trigger was successive, trigger will be fired. Click on successfully checked the trigger on the notification to see the Run History and trigger history.

Image description
c. If status is succeeded in Run history, go to _trigger history**_.

Image description
d. On _trigger history _and select the trigger that was successfully fired.

Image description

Image description
f. From the Run identifier are more details to see the action that happens.

Image description
g. Base on the RSS feed new items, the workflow sends an email for each new item every minute as you have schedule it. Find below item sent by the logic app.

Image description

Image description
h. Once you're done, to avoid excessive charge delete your logic app resource group on the Azure portal, because whenever your app runs, you will be charge.

Top comments (0)