An overview of Azure serverless services with special focus on Azure Logic App.
Tags: azure, beginners, tutorial
Published: 2023-07-19 19:11:29

- 
**PREAMBLE**

In this blog, we will take a review of Azure serverless services with the intent of understanding its components and methodology. We will go further by examining the major difference between two core Azure's serverless services of **Function App** and **Logic App**. Then conclude by creating a **Logic app workflow** in Azure and document our steps in a repository in GitHub.

**WHAT IS AZURE SERVERLESS?**

Azure Serverless is a cloud computing model provided by Microsoft Azure that allows you to build and run applications without managing the underlying infrastructure. With Azure Serverless, you can focus on writing code and developing your application logic without worrying about server provisioning, scaling, or maintenance.

Azure provides several serverless services that enable you to build scalable and event-driven applications. Some key serverless services in Azure include:

**Azure Functions App:** Azure Functions is a serverless compute service that allows you to write code in various programming languages, such as C#, Java, Python, and JavaScript, and execute these codes in response to events or triggers. Functions can be used for various scenarios like data processing and automation.

There is also **Azure Durable Functions** which is an extension of Azure Functions that allows you to write stateful workflows and coordination logic using an orchestrator pattern. It helps in building long-running, scalable, and reliable serverless applications.

**Azure Logic Apps:** Azure Logic Apps is a serverless workflow orchestration service that helps you build business process automation and integrate systems, services, and applications together. It provides a visual designer to create workflows by connecting pre-built connectors and triggers.

**Azure Event Grid:** Azure Event Grid is an event routing service that simplifies the development of event-based applications. It can route events from various Azure services and custom sources to subscribers, which can be Azure Functions, Logic Apps, webhooks, or any other HTTP endpoint.

**Azure App Service:** Azure App Service is a fully managed platform for building and hosting web applications. It supports multiple programming languages and frameworks and provides built-in DevOps capabilities. App Service offers both serverless and dedicated compute options, allowing you to choose based on your application's needs.

**Summary**
Azure Serverless services provide automatic scaling, pay-per-use pricing models, built-in integration with other Azure services, and easy deployment and management through Azure Portal, CLI, or other development tools. These services enable developers to focus on writing code and delivering value without worrying about the underlying infrastructure.

**DIFFERENCE BETWEEN AZURE FUNCTION APP AND AZURE LOGIC APP**

**Azure Function app** and **Azure Logic app** are both serverless services provided by Microsoft Azure, but their difference is in the purposes they serve and their capabilities.
 
**Here is a breakdown of the key differences between the two**

**1. Compute vs Workflow Orchestration:** While Azure Function app is primarily focused on compute, where it allows you to write code (functions) in various programming languages and execute them in response to events or triggers. 
The Azure Logic app on the other hand focuses on workflow orchestration and integration of various systems, services, and applications.

**2. Event-Driven Triggers:** Both apps support event-driven triggers.   However, Logic App triggers are often tied to external events, such as receiving an email, receiving a message from a service bus, or monitoring a specific folder in a storage account.

**3. Stateful vs Stateless:** While Azure Logic Apps are designed to support long-running and stateful workflows. Azure Function Apps on the other hand are stateless by default.

**4. Developer focused vs Networking focused:** Azure Functions are designed to empower developers to write and deploy codes quickly. Logic Apps offer a wide range of connectors that allow you to interact with various services and systems, both within Azure and outside Azure network.

**CREATING A CONSUMPTION WORKFLOW IN AZURE LOGIC APP**

**_Here, we will be creating a consumption workflow in multi-tenant Azure Logic Apps with the Azure portal._**

**Steps**
1. Create a Consumption logic app resource that's hosted in multi-tenant Azure Logic Apps.
2. Select the blank logic app workflow template.
3. Add a trigger that specifies when to run the workflow.
4. Add an action that performs a task after the trigger fires.
5. Run your workflow.

**Prerequisites**

- An Azure account and subscription.

- An email account from a service that works with Azure Logic Apps, such as Office 365 Outlook or Outlook.com.


**Step 1 Create a Consumption logic app resource**

- Sign into Azure portal using this URL `https://portal.azure.com/`

- Type and select **logic app** in the search bar at the top of the page.

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

- On the Logic apps page and toolbar, select **Add**.

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

- On the Create Logic App pane, choose your logic app resource's plan type first. That way, only the options for that plan type appear.

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

- 
Then provide **Azure subscription name**, **Resource Group**, **Logic App name**, **Region** and select **No** for **Enable log analytics**

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

- 
Click **Review + Create**.

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

- On the validation page that appears, confirm all the information that you provided, and select **Create**.

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

**Step 2 Select the blank logic app workflow template**

- After Azure successfully deploys your logic app resource, select **Go to resource**. 

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

- Scroll down past the video and the section named **Start with a common trigger.**

- Under **Templates**, select **Blank Logic App**.


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

- In the designer, under the search box, select **All**. In the search box, enter **rss**.

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

- In the **trigger**, provide the following information:
**The RSS feed URL**, **Publish Date**, **How often do you want to check for items?** and **Frequency**.

For this purpose of this article, we are using the Fox News Network's RSS feed bellow. 
href="https://www.foxnews.com/story/foxnews-com-rss-feeds">

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


- Minimize the trigger.

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


- Then save your workflow, by going to the designer toolbar and click on **Save**.
This step instantly publishes your logic app workflow live in the Azure portal. However, the trigger only checks the RSS feed without taking any other actions. So, you need to add an action to specify what you want to happen when the trigger fires.

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

**Step 3: Add an action**

Following a trigger, an **action** is any subsequent step that runs some operation in the workflow. Any **action** can use the **outputs** from the **previous step**, which can be the **trigger** or another **action**. You can choose from many different actions, include multiple actions up to the limit per workflow, and even create different action paths.

- Under the **When a feed item is published trigger**, select **New step**.


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

- Under the Choose an operation search box, select **All**.

- In the search box, enter send an email. To filter the Actions list to a specific app or service, select the icon for that app or service first.
For this exercise, we selected **Outlook.com**.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zqksx2bwu5qcmfj3ntge.png)
You can now more easily find and select the action that you want. Here, we are selecting **Send an email**.

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

- If your selected email service prompts you to sign in and authenticate your identity, complete that step now.

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

- Choose an email address.

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

- Click on the **Accept** button.

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

- From the **Add dynamic content list**, under **When a feed item is published**, select _Feed title_.

The feed title is a trigger output that references the title for the RSS item. Your email uses this output to show the RSS item's title.

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

- 
In the **dynamic content list**, if no outputs appear from the **When a feed item is published trigger**, next to the action's header, select **See more**.

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

- 
In the Body box, enter email body content.
For this article, the body includes the following properties, descriptive text for each property. To add blank lines in an edit box, press **Shift + Enter.**

When you're done, the email subject looks like the following.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u7omfhgdfqnnk0u702ba.png)
- 
 Save your workflow. On the designer toolbar, select **Save**.


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

**Step 4: Run your workflow**
To check that the workflow runs correctly, we can wait for the trigger to check the RSS feed based on the specified schedule. Or we can manually run the workflow from the designer toolbar.

- Let us run the workflow manually.

- Click on **Run Trigger** on the tool bar menu, then select **Run**.

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

If the RSS feed has new items, your workflow sends an email for each new item. Otherwise, your workflow waits until the next interval to check the RSS feed again.

- A successful manual run.

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

- Screenshot of an email from the workflow.

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

**Step 5: Troubleshoot problems**

- 
Check your email account's junk or spam folder, in case the message was incorrectly filtered.

- 
Make sure the RSS feed you're using has published items since the last scheduled or manual check.

**Checking the Logic App for activity from Azure portal**

- Go to **Overview** on your logic app by clicking on it. 
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wpbd0u8jtb5nc48dykoi.png)

- You can also check activities on your app by clicking on **Resource group** to display activities that has taken place within it.

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

**Step 6: Clean up resources**

Whenever you provisioned resources for learning purpose on any cloud platform, the best practice is to delete as soon as possible. We do this here by deleting the **resource group**. 

- In the Azure search box, enter resource groups, and select **Resource groups**.

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

- Find and select your logic app's resource group. On the **Overview** pane, select **Delete resource group**.

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

- When the confirmation pane appears, enter the resource group name, and select **Delete**.

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

Hope this article help you understand Azure serverless services and an indept knowledge on the Logic App service.

**Thank you for your time. Please subscribe and follow my page for more blogs of this nature**