Steps to Create a Consumption workflow in Azure logic app resource
Published: 2023-07-20 12:19:23

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/svfxjj8lz0cmib0klhos.png)

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9g4t80a76p9yq4l080f0.png)
**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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2l19a7amsituqb871a9g.png)

**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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bdjlp5887075uni1v2ns.png)
b. Shows template with empty workflow.
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5e1god8mo17qa0vh9f0z.png)



**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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4h7ka5y06idofprdemj3.png)
**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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o0ffe6ldn3yw22v78esp.png)
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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dys8f67niklekq4qc5zr.png)
c. Go with the following information in the RSS trigger below shown in yellow.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zcqi0vfj3wpl7gx64rt2.png)

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

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b8gl0g5htvwt426466k9.png)
**_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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kwyr958n4cmojenjq5qp.png)
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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xa893e80wiqinyqsmcbs.png)
**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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yttye1c5szh06tryc0tg.png)
d. You will be prompted to sign in and authenticate your identity.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j3ej6hkfttfb84chnpk3.png)
e. Accept the permission settings.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/csrlfoed3by7e302pb64.png)
**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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ihwzxan60gj501876vf.png)

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bsvwk50y9a8juog7uyjs.png)
**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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7pbwjtjdl3dopexuv82a.png)

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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4trfpkivaul455m95ki0.png)
i. Once done click save.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dd4nihlzhdgrhyxg6vws.png)

**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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ar9edwit1nwf49l7poko.png)
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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bqhycz935j575broveu3.png)
c. If _**status**_ is _**succeeded**_ in _**Run history**_**, go to _**trigger history**_.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nk9k7f2ivu0osy9p381u.png)
d. On _trigger history _and select the trigger that was successfully fired.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r5jyiq8t5ob2vrdfs3c2.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7d80f1tc0qgzzflju6d5.png)
f. From the Run identifier are more details to see the action that happens.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4yrwixfqpgqhx5o1j8fx.png)
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](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1aps7iujzsadu8bph3ep.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zegov54dwhtqfxu8gga7.png)
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.