Azure Functions Doctor¶
Validate Azure Functions Python v2 projects before they fail in local runtime or CI.
azure-functions-doctor is a diagnostics CLI and API that checks required project health signals, reports optional operational guidance, and returns deterministic exit codes for automation.
Why teams use it¶
- Catch missing baseline files (
host.json,requirements.txt) early - Verify runtime and dependency declarations before deployment
- Gate merges on required blockers while preserving optional guidance
- Export machine-readable diagnostics for CI and code-scanning systems
Working example¶
Install and run in the current project:
Run required-only checks in CI:
What it checks¶
Built-in diagnostics currently include:
- Python version support
- v2 decorator programming model signal
- virtual environment presence
- Python executable path validity
requirements.txtandazure-functionsdeclarationhost.jsonpresence- optional tooling, telemetry, extension, and cleanup checks
Reference: Rule Inventory
Output and gating model¶
Item statuses:
passwarn(optional check failed)fail(required check failed)
Exit code contract:
0when required checks all pass1when any required check fails
This enables direct CI usage without custom gate wrappers.
Feature highlights¶
- Declarative rules with schema validation
- Profile-based execution (
full,minimal) - Multiple output formats (
table,json,sarif,junit) - Custom rule file support via
--rules - Programmatic API for pipeline/tool integration
CLI and API entry points¶
- CLI:
azure-functions doctor - API:
from azure_functions_doctor.api import run_diagnostics
Programmatic example:
from azure_functions_doctor.api import run_diagnostics
def has_required_failures(path: str) -> bool:
for section in run_diagnostics(path=path, profile="minimal", rules_path=None):
for item in section["items"]:
if item["status"] == "fail":
return True
return False
Documentation map¶
Get started¶
User guide¶
Examples¶
Maintenance and policies¶
Typical adoption path¶
- Install package in your development environment
- Run
azure-functions doctorlocally and fix required failures - Add CI job using
--profile minimal --format json - Publish JSON/SARIF/JUnit artifacts for visibility
- Add optional custom rules for organization-specific policy
Notes on scope¶
Note
Azure Functions Doctor targets the Python v2 decorator model.
Legacy Python v1 (function.json-oriented) projects are out of scope.
Need help?¶
Start with Troubleshooting, then review FAQ. If behavior looks incorrect, include command, version, and JSON output snippet when opening an issue.