Wednesday, June 2, 2021

Azure Functions Vs Logic Apps

An Azure function is a code triggered by an event whereas an Azure Logic app is a workflow triggered by an event.

Azure Logic App can define a workflow at ease consuming a range of APIs as connectors. These connectors will perform series of actions defined in the workflow. Like Azure Logic Apps, durable Azure Functions can also be used to define workflow in code structure.



Continue Reading →

Azure Functions

Azure Functions allows a piece of code to be deployed and executed without needing server infrastructure, web server, or any configurations. In addition, azure functions can be written in multiple languages such as C#, Java, JavaScript, TypeScript, and Python.

Here are some key concepts related to Azure Functions:

  1. Trigger: A trigger is what causes a function to run. Azure Functions support various triggers, such as HTTP requests, timers, messages from a message queue (like Azure Service Bus or Azure Queue Storage), blob storage events, and more.

  2. Bindings: Bindings are a way to connect input and output data to a function. They simplify the code needed to interact with other Azure services. For example, you can use input bindings to read data from Azure Storage, and output bindings to write data back to it without having to write code for these operations explicitly.

  3. Language Support: Azure Functions supports multiple programming languages, including C#, JavaScript, Python, and more. You can choose the language that best fits your needs and skills.

  4. Durable Functions: This is an extension of Azure Functions that lets you write stateful functions in a serverless environment. It's particularly useful for workflows and scenarios where you need to manage state across multiple function invocations.

  5. Development Tools: You can develop Azure Functions using the Azure Portal, Visual Studio, or other supported IDEs. Azure Functions Core Tools is a set of command-line tools that facilitates local development and testing.

  6. Pricing: Azure Functions pricing is based on the actual execution of functions and the resources consumed by them. You pay only for the compute resources consumed during execution.

To create an Azure Function, you typically follow these steps:

  1. Create a Function App: This is a container for your functions. It provides a way to manage and deploy related functions together.

  2. Create a Function: Once you have a Function App, you can add individual functions to it. Each function can have its own trigger and bindings.

  3. Configure and Test: Configure the function with any necessary settings, including connection strings and other environment variables. Test the function locally before deploying it to Azure.

  4. Deploy: Deploy your function to Azure using the deployment options provided by your development environment.

  5. Monitor and Debug: Azure Functions integrates with Azure Monitor, allowing you to monitor the performance and health of your functions. You can also enable logging and diagnostics to aid in debugging.

Keep in mind that Azure Functions is just one part of the broader Azure ecosystem, and you can integrate functions with other Azure services to build powerful and scalable solutions.

When to use:

Let’s say, you have to send a birthday email to your customers. You’re an ASP.NET web developer. Instead of building a website in ASP.NET, deploy and hosting it on IIS, just for one feature, you can simply write an azure function and put your email login in the function and deploy it on azure cloud. The azure functions will direct connect to your data source, get your customers emails, and send them an email on a scheduled date and time.

Azure functions are best suited for smaller apps have events that can work independently of other websites. Some of the common azure functions are sending emails, starting backup, order processing, task scheduling such as database cleanup, sending notifications, messages, and IoT data processing.

Why use Azure Functions

Here are some of the reasons why you should use azure functions. 

  1. Azure functions are lightweight and serverless.
  2. Azure functions are easier to write and deploy.
  3. Azure functions are fast to execute because there is no large application, startup time, initialization, and other events fired before the code is executed.
  4. Azure functions’ execution is triggered when an event is fired.
  5. Azure functions are compute-on-demand and that is scalable. When demand of execution increases, more resources are allocated automatically to the service and when requests fall, all extra resources and application instances drop off automatically.
  6. Azure functions support multiple programming languages including C#, F#, Java, JavaScript, TypeScript, and Python. You choose your choice of language.
  7. Azure functions do not need any infrastructure and have 0 maintenance.
  8. Azure function can be build, tested, and deployed in Azure portal using a browser.
  9. Azure functions are easy to upgrade and doesn’t affect other parts of the website.
  10. Azure functions use industry standard and can communicate with other APIs, databases, and libraries.

Reference: https://www.c-sharpcorner.com/https://www.serverless360.com/azure-functions


Continue Reading →

Azure Logic Apps

 What is Azure Logic Apps?

Azure Logic Apps is a cloud-based platform for creating and running automated workflows that integrate your apps, data, services, and systems. With this platform, you can quickly develop highly scalable integration solutions for your enterprise and business-to-business (B2B) scenarios.

The following list describes just a few example tasks, business processes, and workloads that you can automate using the Logic Apps service:

  1. Schedule and send email notifications using Office 365 when a specific event happens, for example, a new file is uploaded.
  2. Route and process customer orders across on-premises systems and cloud services.
  3. Move uploaded files from an SFTP or FTP server to Azure Storage.
  4. Monitor tweets, analyze the sentiment, and create alerts or tasks for items that need review.

How logic apps work

In a logic app, each workflow always starts with a single trigger. A trigger fires when a condition is met, for example, when a specific event happens or when data meets specific criteria. 

Following the trigger, one or more actions run operations that, for example, process, handle, or convert data that travels through the workflow, or that advance the workflow to the next step.

For example, the following workflow starts with a Dynamics trigger that has a built-in condition named When a record is updated. The actions include transforming XML, calling a web app that updates data, evaluating a condition that controls which actions to take, and sending an email notification with the results. When the trigger detects an event that meets the condition, the trigger fires, and the actions in the workflow start to run. Each time the trigger fires, the Logic Apps service creates a workflow instance that runs the actions.

You can visually create workflows using the Logic Apps designer in the Azure portal, Visual Studio Code, or Visual Studio. Each workflow also has an underlying definition that's described using JavaScript Object Notation (JSON). If you prefer, you can edit workflows by changing this JSON definition. For some creation and management tasks, Logic Apps provides Azure PowerShell and Azure CLI command support. 

Why use Logic Apps
The Logic Apps integration platform provides prebuilt Microsoft-managed API connectors and built-in operations so you can connect and integrate apps, data, services, and systems more easily and quickly. You can focus more on designing and implementing your solution's business logic and functionality, not on figuring out how to access your resources.

You usually won't have to write any code. However, if you do need to write code, you can create code snippets using Azure Functions and run that code from your workflow. You can also create code snippets that run in your workflow by using the Inline Code action.

References: https://docs.microsoft.com

Continue Reading →