Skip to main content

Azure Functions

"Serverless: run code on trigger without managing servers"


What are Azure Functions?

Azure Functions is a serverless compute service. You write a function (e.g. C#, JavaScript, Python); Azure runs it when a trigger fires (HTTP, timer, queue, blob, etc.) and scales automatically.


Memory hook

"Function = code + trigger + optional bindings; pay per execution"


Core concepts

  • Function app — host for one or more functions; has runtime (e.g. Node 20, .NET 8) and plan
  • Trigger — what starts the function (HTTP, Timer, Queue, Blob, Event Grid, etc.)
  • Binding — input/output to services (e.g. read from Queue, write to Blob)
  • Hosting plan — Consumption (pay per exec), Premium, Dedicated (App Service)

Triggers (examples)

TriggerUse case
HTTPREST API, webhooks
TimerScheduled job (cron)
QueueProcess queue messages
BlobReact to new/updated blobs
Event GridReact to events (e.g. blob created)
Cosmos DBReact to DB changes

Bindings (examples)

  • Input — queue message, blob content, Cosmos document
  • Output — write to queue, blob, table, Cosmos
  • Return — HTTP response (for HTTP trigger)

Example (HTTP trigger, Node)

module.exports = async function (context, req) {
context.log('HTTP trigger');
const name = req.query.name || req.body?.name;
context.res = { body: `Hello, ${name}` };
};

Hosting plans

  • Consumption — scale to zero; pay per execution and GB-s; cold start possible
  • Premium — pre-warmed instances; VNet; no cold start
  • Dedicated (App Service) — always-on; full App Service features

Interview one-liner

"Azure Functions is serverless: you write a function and attach a trigger (HTTP, timer, queue, blob, etc.) and optional bindings. Consumption plan scales to zero and charges per execution; Premium avoids cold starts."


Cheat sheet

Function app = host; function = code + trigger
Trigger = HTTP, Timer, Queue, Blob, Event Grid
Binding = input/output to queue, blob, DB
Consumption = scale to zero, pay per exec
Premium = pre-warm, VNet, no cold start