Skip to content

Recipes

Practical recipes for building real-world Azure Functions with Python v2. Each recipe is paired with a runnable project in examples/.

Tip

Read the recipe, then run the matching example. Every example includes a function_app.py ready for func start.


HTTP

Recipe Difficulty Description
Hello HTTP Minimal Beginner Simplest GET endpoint with optional name parameter
HTTP Routing, Query & Body Intermediate Full CRUD with route params, query strings, and JSON body parsing
HTTP Auth Levels Beginner ANONYMOUS, FUNCTION, and ADMIN auth level comparison
Webhook (GitHub) Intermediate HMAC-SHA256 signature verification and event dispatch

Timer

Recipe Difficulty Description
Timer Cron Job Beginner NCRONTAB scheduled execution with past_due detection

Queue

Recipe Difficulty Description
Queue Producer Beginner HTTP POST to queue output binding with payload validation
Queue Consumer Beginner Queue trigger with JSON deserialization and dequeue-count logging

Blob

Recipe Difficulty Description
Blob Upload Processor Intermediate Polling-based blob trigger with checksum calculation
Blob Event Grid Trigger Intermediate Low-latency push-based blob trigger via Event Grid

Service Bus

Recipe Difficulty Description
Service Bus Worker Intermediate Queue trigger with correlation ID tracking and dead-letter guidance

Event Hub

Recipe Difficulty Description
Event Hub Consumer Intermediate Partition-aware event processing with offset tracking

Cosmos DB

Recipe Difficulty Description
Change Feed Processor Intermediate Change feed trigger with lease container and batch processing

Patterns

Recipe Difficulty Description
Blueprint Modular App Intermediate Multi-file structure with func.Blueprint() for large projects
Retry & Idempotency Intermediate @app.retry() decorator with fixed-delay strategy and dedup
Output Binding vs SDK Intermediate Side-by-side comparison of binding vs QueueClient SDK
Managed Identity (Storage) Advanced Identity-based Storage Queue connections with __queueServiceUri
Managed Identity (Service Bus) Advanced Identity-based Service Bus with __fullyQualifiedNamespace
host.json Tuning Advanced Logging, timeout, and extension settings for performance
Concurrency Tuning Advanced Dynamic concurrency vs static batchSize strategies

Durable Functions

Recipe Difficulty Description
Hello Sequence Beginner Orchestrator chaining three sequential activities
Fan-Out / Fan-In Intermediate Parallel activity execution with context.task_all()
Human Interaction Intermediate Approval workflow with external event and timeout
Entity Counter Intermediate Durable entity with add/reset/get operations
Retry Pattern Intermediate call_activity_with_retry with RetryOptions
Determinism Gotchas Advanced Safe vs unsafe patterns in orchestrator replay
Unit Testing Advanced Mock-based testing with generator stepping

AI

Recipe Difficulty Description
MCP Server Advanced Model Context Protocol JSON-RPC 2.0 server over HTTP

Local Development

Recipe Difficulty Description
Local Run & Direct Invoke Beginner Two approaches: func start vs direct Python import

How to Choose

Pick by your primary trigger:

  1. Synchronous request/response → HTTP recipes
  2. Scheduled execution → Timer recipe
  3. Async message processing → Queue or Service Bus recipes
  4. Event streaming → Event Hub recipe
  5. File processing → Blob recipes
  6. Change data capture → Cosmos DB recipe
  7. Multi-step workflows → Durable Functions recipes
  8. AI tool serving → MCP Server recipe

Then refine with patterns:

  • Need modular code → Blueprint Modular App
  • Need managed identity → Identity recipes
  • Need performance tuning → host.json or Concurrency recipes
  • Need reliability → Retry & Idempotency

Structure of Each Recipe

Every recipe follows a consistent format:

  • Overview — What and why
  • When to Use — Decision criteria
  • Architecture — ASCII data-flow diagram
  • Prerequisites — Tools and packages
  • Project Structure — File layout
  • Implementation — Code walkthrough with real snippets
  • Run Locally — Step-by-step local execution
  • Expected Output — What you should see
  • Production Considerations — Scaling, retries, security
  • Related Recipes — Cross-links