Azure Functions Python Cookbook¶
Practical, production-oriented recipes for building Azure Functions with the Python v2 programming model.
What this project is
This repository is a cookbook and pattern catalog. It is not a runtime library you install as application dependency.
Why this cookbook exists¶
Azure Functions documentation is broad, but many teams still need concrete, copy-adapt-run patterns for common workloads. This cookbook focuses on that gap by pairing clear recipe narratives with runnable examples.
What you get¶
- Trigger-focused recipes for real workloads (HTTP, webhook, queue, timer)
- Runnable sample apps under
examples/ - Production considerations in every recipe
- Consistent structure for learning, implementation, and contribution
Recipe cards¶
HTTP¶
- Hello HTTP Minimal — minimal route handler
- HTTP Routing, Query, and Body — parse params and JSON body
- HTTP Auth Levels — function vs anonymous vs admin keys
- GitHub Webhook — secure signed event ingestion
Queue & Service Bus¶
- Queue Producer — enqueue messages via output binding
- Queue Consumer — process messages with retry semantics
- Service Bus Worker — durable message processing
Blob & Event Hub & Cosmos DB¶
- Blob Upload Processor — react to new blob arrivals
- Blob Event Grid Trigger — Event Grid-backed blob trigger
- Event Hub Consumer — high-throughput stream processing
- Change Feed Processor — Cosmos DB downstream sync
Timer¶
- Timer Cron Job — scheduled maintenance and periodic automation
Patterns¶
- Blueprint Modular App — split handlers across modules
- Retry and Idempotency — safe retries and deduplication
- Output Binding vs SDK — when to use bindings vs direct calls
- Managed Identity (Storage) — keyless storage access
- Managed Identity (Service Bus) — keyless bus access
- host.json Tuning — concurrency and retry knobs
- Concurrency Tuning — worker process and thread settings
Durable Functions¶
- Hello Sequence — basic orchestration chain
- Fan-Out / Fan-In — parallel activity execution
- Human Interaction — approval and wait patterns
- Entity Counter — stateful entity pattern
- Retry Pattern — activity-level retry strategies
- Determinism Gotchas — pitfalls to avoid
- Unit Testing — test orchestrations without a host
AI & Local Dev¶
- MCP Server — Model Context Protocol server example
- Local Run and Direct Invoke — test without deploying
Quick start¶
git clone https://github.com/yeongseon/azure-functions-python-cookbook.git
cd azure-functions-python-cookbook
python -m venv .venv
source .venv/bin/activate
Run one example:
Then test:
Recommended learning path¶
- Installation
- Getting Started
- Recipes Overview
- Pick one deep-dive recipe page
- Run the matching
examples/<name>project - Validate with Testing
Repository map¶
docs/ Documentation site pages and recipe deep-dives
recipes/ Source recipe narratives and template contract
examples/ Runnable Azure Functions app implementations
Ecosystem projects¶
These companion projects integrate well with cookbook patterns:
azure-functions-scaffold-> project bootstrap from known templatesazure-functions-validation-> request/response validation helpersazure-functions-openapi-> generated API contracts and Swagger UIazure-functions-logging-> structured telemetry and diagnosticsazure-functions-doctor-> local environment diagnosis
Contributing and quality¶
If you want to improve recipes or examples:
- Use Development for workflow
- Use Testing before submitting changes
- Follow Contributing Guidelines
Additional references¶
- Pattern model and boundaries: Architecture
- Planned expansion: Roadmap
- Common failures and fixes: Troubleshooting
- Frequently asked questions: FAQ
Tip
The fastest path to value is: pick one recipe, run its example, then adapt for your production constraints.