advanced

Functions

Run event-driven serverless code with bindings, triggers, plans, cold-start trade-offs, and managed identity permissions.

Azure Functions runs event-driven, short-lived code with triggers (HTTP, queues, timers, blobs) and bindings that wire inputs and outputs without boilerplate. Plans range from consumption (pay per execution) to Premium (pre-warmed instances) and dedicated App Service plans.

| Concept | Meaning | |---------|---------| | Trigger | What starts the function | | Binding | Declarative input/output wiring | | Durable Functions | Orchestration and saga-style workflows | | Managed identity | Passwordless access to Azure resources |

					module.exports = async function (context, req) {
  context.log('HTTP trigger processed a request.');
  context.res = { status: 200, body: { ok: true } };
};
				

On interviews: consumption vs Premium cold starts; timeout and concurrency limits; idempotent queue handlers; Durable Functions for long workflows; and when Functions is wrong for steady HTTP traffic.

Common pitfalls: long-running work on consumption plan; storing state in static variables; duplicate processing without idempotency keys; and overusing Functions where App Service or a container is cheaper and simpler.

The trade-off is near-zero ops and granular billing versus cold starts, execution limits, and harder local debugging compared to a always-on service.

Checklist:

  • Match hosting plan to latency and duration needs.
  • Design triggers for at-least-once delivery semantics.
  • Use managed identity instead of connection-string secrets.
  • Add dead-letter handling for queue triggers.
  • Load-test cold start and concurrency before launch.