Azure Functions
What is Azure Functions?
Azure Functions is a serverless compute service that lets you run event-driven code without managing servers. You only pay for the time your code runs.
Key Features
⭐ 1. Event-Driven
Functions can be triggered by:
-
HTTP requests
-
Timer (CRON schedule)
-
Azure Storage (Blob/Queue)
-
Event Hub / Service Bus
-
Cosmos DB changes
-
Event Grid events
⭐ 2. Multiple Languages Supported
-
C# (.NET)
-
JavaScript / TypeScript
-
Python
-
Java
-
PowerShell
-
Go (preview/open-source extension)
⭐ 3. Consumption Based
Pricing models:
-
Consumption Plan: Pay per execution, auto-scale
-
Premium Plan: Pre-warmed instances, VNET
-
Dedicated (App Service): Runs on normal App Service plan
Execution Model
Bindings
Bindings reduce boilerplate code.
Input Bindings
Receive data (e.g., blob, queue message)
Output Bindings
Send data (e.g., write to queue, send to Cosmos DB)
Trigger vs Binding
-
Trigger: Starts the function
-
Binding: Connects to external services
Scaling
Azure Functions automatically scale based on:
-
Number of events
-
Trigger type
-
Plan (Consumption scales fastest)
Use Cases
-
CRON jobs
-
Image/file processing
-
API backends
-
Stream/event processing
-
Automation workflows
Pros
-
No server management
-
Auto-scaling
-
Pay-as-you-go
-
Fast development
Cons
-
Cold start (Consumption plan)
-
Execution timeout limits
-
Vendor lock-in