/
Why Azure Functions ?

Why Azure Functions ?

  1. Technical reasons

    1. Data type format.
      Get a JSON format to send to a database receiving a JSON format. A Web Service could return data in JSON format and Azure Function could easily act as intermediary in order to send data to a database (using semi-structured data type like Azure Cosmos DB).

    2. Process file uploads.
      Process files into or out of a Blob Storage container. We can use a blob trigerred function to validate, transform and process files into the main system as they’re uploaded : Azure Functions Scenarios | Microsoft Learn

    3. Real-time stream & event processing.
      Process data in near real-time as the hot path, the store it in Cosmos DB for use in an Analytics dashboard. Function can also use low-latency event triggers (like Event Frid) and real-time outputs like SignalR to process data in near real-time : Azure Functions Scenarios | Microsoft Learn

    4. Machine learning and AI.
      Can be used to infer on models. Also, can connect to other services to help process data and performother AI-related tasks (like text summarization) : Azure Functions Scenarios | Microsoft Learn

    5. Run scheduled tasks.
      Run code based on a cron schedule we define like analyze data for duplicate entries every 15 minutes to avoid multiple communications between systems : Azure Functions Scenarios | Microsoft Learn

    6. Build a scalable web API.
      HTTP endpoint can run function code that can connect to other services directly or by using binding extensions. Can also use an HTTP trigerred function endpoint as a webhook integration (like Github webhooks) - so we can process data from Github events for example : Azure Functions Scenarios | Microsoft Learn

    7. Build a serverless workflow.
      Used as compute component is a serverles workflow and can create long-running orchestrations using the Durable Functions extension : Azure Functions Scenarios | Microsoft Learn

    8. Respond to database changes.
      Process where we might need to log, audit or perform some other operation when stored data changes and function triggers provide a good way to get notified of data changes : Azure Functions Scenarios | Microsoft Learn

    9. Create a reliable message systems.
      Use with Azure Messaging to create advanced event-driven messaging solutions. So, use triggers on Azure Storage queues as a way to chain a series of function executions or a Services Bus queues : Azure Functions Scenarios | Microsoft Learn

  2. Cost reasons

    1. In some cases, we are only billed for the time our function code runs (Consumption plan).

    2. Existing different hosting plans : validate the service limits : Azure Functions scale and hosting | Microsoft Learn

      1. Consumption plan : As default plan, Scale automatically & only pay for compute resources when functions are running.

      2. Premium plan : Only charged for each instance allocated in the minimum instance count regardless if functions are executing or not. Automatically scales based on demand using pre-warmed workers which run apps with no delay after being idle and connects to virtual networks (See how to integrate function app in VNET - Use private endpoints to integrate Azure Functions with a virtual network | Microsoft Learn).

      3. Dedicated plan : Best for long-running scenarios where Durable Functions can’t be used and need to consider an App Service Plan in

        1. when we have underutilized VMs that are already running other App Service instances;

        2. when predictive scaling and costs are requires.