Azure Functions Scaffold¶
Scaffold production-ready Azure Functions Python v2 projects in one command.
azure-functions-scaffold gives you a clean, modular starting point with
opinionated defaults, optional feature integrations, and predictable structure.
Use the short alias afs or the full command name interchangeably.
The 5-Second Rule¶
If you only remember one command, remember this:
That creates a working HTTP project scaffold with a practical default preset.
Why Teams Use It¶
- Start fast without copy-pasting old repos.
- Keep function projects consistent across engineers.
- Separate triggers, services, schemas, and runtime setup from day one.
- Add more triggers later using a safe, repeatable command.
Scope
This tool scaffolds Azure Functions Python v2 projects. It does not replace Azure Functions runtime tools or hosting services.
Feature Overview¶
Commands¶
afs new <name>creates a new project.afs add <trigger> <name>adds a function module to an existing project.afs templateslists built-in templates.afs presetslists quality/tooling presets.
Templates¶
httptimerqueueblobservicebus
Presets¶
minimal: no extra quality toolingstandard: Ruff + pytest (default)strict: Ruff + mypy + pytest
Optional Feature Flags¶
--with-openapi: OpenAPI routes and Swagger UI for HTTP projects--with-validation: request/response model validation for HTTP projects--with-doctor: addsazure-functions-doctorintegration and command target
What You Get in a New Project¶
Typical scaffold layout:
my-api/
|- function_app.py
|- host.json
|- local.settings.json.example
|- pyproject.toml
|- Makefile
|- app/
| |- core/
| |- functions/
| |- services/
| `- schemas/
`- tests/
Design goals of this layout:
- keep trigger wiring in
app/functions/ - keep business logic in
app/services/ - keep contracts in
app/schemas/ - keep runtime utilities in
app/core/ - keep behavior verifiable in
tests/
Quick Start Flow¶
pip install azure-functions-scaffold
afs new my-api --preset standard
cd my-api
python -m venv .venv
. .venv/bin/activate
pip install -e .[dev]
func start
Then hit the default route:
Common Command Patterns¶
# Strict HTTP API with docs and validation
afs new orders-api --preset strict --with-openapi --with-validation
# Timer-based scheduled job
afs new nightly-job --template timer --preset standard
# Add another endpoint to an existing project
afs add http get_user --project-root ./orders-api
# Preview generation without writing files
afs new sandbox-api --dry-run
Safe rollout
Use --dry-run in CI or automation to validate planned output before
writing files.
Choose Your Path¶
- New to the scaffold? Start with Getting Started.
- Deciding flags and presets? Read Configuration.
- Need end-to-end samples? Use HTTP API, Timer Job, and Full Stack examples.
- Integrating programmatically? See API Reference.
Operational Notes¶
- Project names must start with an alphanumeric character and can include
alphanumerics,
_, and-. afs addmust point to a valid scaffold project root.- Local execution and publish flows use Azure Functions Core Tools (
func).