```html Azure Functions – Documentation

Azure Functions

Overview

Azure Functions is a serverless compute service that lets you run event‑driven code without having to provision or manage infrastructure. Write code in the language of your choice, pay only for the time your code runs, and scale automatically.

Get Started

  1. Open the Azure Portal and create a new Function App.
  2. Select a runtime stack (e.g., Node.js, .NET, Python, Java).
  3. Choose a hosting plan: Consumption, Premium, or Dedicated.
  4. Deploy your first function using the portal, VS Code, or Azure CLI.

Triggers

Functions are invoked by triggers. Common triggers include:

  • HTTP request
  • Timer (cron)
  • Blob storage changes
  • Queue messages
  • Event Grid events

Bindings

Bindings simplify input and output connections to other services. You can declaratively bind to:

  • Azure Cosmos DB
  • Azure Service Bus
  • SignalR
  • SQL Database

Monitoring & Diagnostics

Azure Functions integrates with Application Insights for live metrics, request tracing, and performance analysis. Enable it during creation or via the portal.

Pricing

Pay only for the compute resources your functions consume. The Consumption plan offers a free grant of 1 million executions per month.

PlanBilling
ConsumptionPer execution & GB‑seconds
PremiumPre‑warmed instances + executions
DedicatedApp Service pricing

Sample Function – HTTP Trigger (JavaScript)

index.js

module.exports = async function (context, req) {
    const name = (req.query.name || (req.body && req.body.name)) || "World";
    context.res = {
        // status: 200, /* Defaults to 200 */
        body: `Hello, ${name}!`
    };
};
                

This function returns a greeting based on the name query string or JSON body.

```