Skip to main content

Azure Functions Doctor

Part of the Azure Functions Python DX Toolkit — dogfood-tested by azure-functions-cookbook-python.

PyPI Downloads Python Version CI Release Security Scans codecov pre-commit Docs License: MIT

Read this in: 한국어 | 日本語 | 简体中文

Azure Functions Doctor is the pre-deploy health gate for Azure Functions Python v2 projects — a diagnostic CLI that catches configuration issues, missing dependencies, and environment problems before they cause runtime failures in production.


Part of the Azure Functions Python DX Toolkit → Bring FastAPI-like developer experience to Azure Functions

Why this exists

Deploying a broken Azure Functions app is expensive — the worker starts, the host reads config, and only then does it surface the issue in a production log. Common problems that slip through:

  • Missing dependenciesazure-functions not in requirements.txt, discovered only at cold start
  • Invalid configurationhost.json misconfigured, extensionBundle missing or outdated
  • Runtime incompatibilities — Python version mismatch with Azure Functions runtime
  • Silent failures — no virtual environment, Core Tools not installed, Application Insights key missing

azure-functions-doctor moves that failure left — catch it locally or in CI, not in production.

What it does

  • 14+ diagnostic checks — Python version, dependencies, host.json, Core Tools, Durable Functions, and more
  • Multiple output formats — table, JSON, SARIF, JUnit for CI integration
  • Profile supportminimal or full rulesets depending on your needs
  • Official GitHub Actionyeongseon/azure-functions-doctor@v1 for CI gates

Scope

This repository targets the decorator-based Azure Functions Python v2 programming model only. Non-v2 repositories are detected up front and reported as unsupported instead of running v2-only checks.

  • Supported model: func.FunctionApp() with decorators such as @app.route()
  • Unsupported model: legacy function.json-based Python v1 projects

Use azure-functions-doctor as part of a pre-deployment checklist alongside azure-functions-logging for observability.

What this package does not do

This package does not own:

  • Fixing issues — it diagnoses configuration problems but does not auto-fix them
  • API documentation — use azure-functions-openapi for API documentation and spec generation
  • Request validation — use azure-functions-validation for request/response validation and serialization

Installation

From PyPI:

pip install azure-functions-doctor

From source:

git clone https://github.com/yeongseon/azure-functions-doctor-python.git
cd azure-functions-doctor-python
python3 -m venv .venv
source .venv/bin/activate
pip install -e .

Quick Start

Run the doctor in the current project:

azure-functions-doctor doctor

Run against a specific project:

azure-functions-doctor doctor --path ./examples/v2/http-trigger

Use a required-only profile:

azure-functions-doctor doctor --profile minimal

Output JSON for CI:

azure-functions-doctor doctor --format json

Pin the Azure Functions target runtime explicitly:

azure-functions-doctor doctor --target-python 3.12

Use --target-python when the Python running azure-functions-doctor is not the same as the Python version your Function App will run on Azure.

Command name and deprecated aliases

azure-functions-doctor is the canonical command. Two legacy console-script aliases still work but are deprecated and print a warning when invoked:

Command Status
azure-functions-doctor Canonical — use this.
azure-functions Deprecated — removal targeted for v1.0.0.
fdoctor Deprecated — removal targeted for v1.0.0.

Migrate any scripts or CI pipelines to azure-functions-doctor before the v1.0.0 release removes the aliases.

See the deprecated aliases migration guide for step-by-step examples covering shell scripts, GitHub Actions, Makefiles, and pre-commit hooks.

Sample output (excerpt)

azure-functions-doctor doctor --path ./examples/v2/http-trigger
Azure Functions Doctor
Path: ./examples/v2/http-trigger

Programming Model
[✓] Programming model v2: Keyword '@app.|@bp.' found in source code (AST)

Python Env
[✓] Python version: Python 3.10.12 (tool runtime, >=3.10)
[✓] requirements.txt: requirements.txt exists
[✓] azure-functions package: Package 'azure-functions' declared in requirements.txt

Project Structure
[✓] host.json: host.json exists
[✓] host.json version: host.json version is "2.0"

Tooling
[✓] Azure Functions Core Tools (func): func detected

...

Doctor summary:
  0 fails, 5 warnings, 15 passed
Exit code: 0

The same command runs in CI pipelines — see CI Integration below and docs/deployment.md for details.

CI Integration

Use azure-functions-doctor as a CI gate to block deployments on required failures.

GitHub Actions (CLI)

- name: Run azure-functions-doctor
  run: |
    pip install azure-functions-doctor
    azure-functions-doctor doctor --profile minimal --format json --output doctor.json

- name: Upload report
  if: always()
  uses: actions/upload-artifact@v4
  with:
    name: doctor-report
    path: doctor.json

Official GitHub Action

- uses: yeongseon/azure-functions-doctor@v1
  with:
    path: .
    profile: minimal
    format: sarif
    output: doctor.sarif
    upload-sarif: "true"

See docs/examples/ci_integration.md for Azure DevOps, pre-commit, VS Code, and SARIF upload examples.

Demo

The demo below is generated from demo/doctor-demo.tape with VHS. It runs the real azure-functions-doctor doctor CLI against the representative example and then against an intentionally broken copy to show the pass/fail contrast.

Doctor demo

The final terminal state is also captured as a static image for quick inspection.

Doctor final output

Default ruleset

The default ruleset includes checks for:

  • Azure Functions Python v2 decorator usage
  • Python version
  • virtual environment activation
  • Python executable availability
  • requirements.txt
  • azure-functions dependency declaration
  • host.json
  • local.settings.json (optional)
  • Azure Functions Core Tools presence and version (optional)
  • Durable Functions host configuration (optional)
  • Application Insights configuration (optional)
  • extensionBundle configuration (optional)
  • ASGI/WSGI callable exposure (optional)
  • common unwanted files in the project tree (optional)

Examples

Requirements

  • Python 3.10+
  • Hatch for development workflows
  • Azure Functions Core Tools v4+ recommended for local runs

When to use

  • Before deploying an Azure Functions app (local pre-flight check)
  • In CI/CD pipelines as a deployment gate
  • When onboarding a new developer to catch environment setup issues
  • After upgrading Python version or Azure Functions runtime
  • As a pre-commit hook for configuration validation

How It Works

azure-functions-doctor doctor loads a JSON ruleset, dispatches each rule to a type-based handler, and aggregates the results into per-section output:

flowchart LR
    CLI["cli.py<br/>Typer CLI"] --> DOC["doctor.py<br/>Diagnostic runner"]
    DOC --> RULES[("assets/<br/>Rule inventory")]
    DOC --> HDLR["handlers.py<br/>Type-based dispatch"]
    HDLR --> TR["target_resolver.py<br/>Version resolution"]
    DOC --> RES["SectionResult<br/>+ CheckResult"]
    RES --> OUT["table / json<br/>sarif / junit"]

See docs/architecture.md for the full component and sequence diagrams, and docs/diagnostics.md for the rule-evaluation pipeline.

Documentation

Ecosystem

This package is part of the Azure Functions Python DX Toolkit.

Design principle: azure-functions-doctor owns pre-deploy diagnostics. It does not fix issues or generate code — it surfaces actionable findings so developers can fix them. Runtime behavior belongs to azure-functions-openapi (API documentation and spec generation), azure-functions-validation (request/response validation), and azure-functions-langgraph (LangGraph runtime exposure).

Package Role
azure-functions-openapi-python OpenAPI spec generation and Swagger UI
azure-functions-validation-python Request/response validation and serialization
azure-functions-db-python SQLAlchemy-powered DB integration helpers (poll-based pseudo trigger, input/output/client injection)
azure-functions-langgraph-python LangGraph deployment adapter for Azure Functions
azure-functions-scaffold-python Project scaffolding CLI
azure-functions-logging-python Structured logging and observability
azure-functions-doctor-python Pre-deploy diagnostic CLI
azure-functions-durable-graph-python Manifest-first graph runtime with Durable Functions (experimental)
azure-functions-knowledge-python Knowledge retrieval (RAG) decorators
azure-functions-cookbook-python Dogfood examples — runnable recipes that exercise the full toolkit

For AI Coding Assistants

This repository includes llms.txt and llms-full.txt for LLM-friendly documentation:

  • llms.txt — Concise index of package info, CLI commands, quick start, and ecosystem overview
  • llms-full.txt — Comprehensive API reference with output formats, diagnostic rules, custom rules, and CI integration patterns

When working with this codebase, LLM assistants should:

  1. Use llms.txt for quick reference — the canonical package version (0.19.1), Python requirements (>=3.10,<3.15), CLI entry points
  2. Refer to llms-full.txt for implementation details — output contracts, rule structure, custom rule patterns, handler types
  3. Check src/azure_functions_doctor/cli.py — authoritative source for CLI options and validation
  4. Review src/azure_functions_doctor/assets/rules/v2.json — complete ruleset with check definitions
  5. Consult src/azure_functions_doctor/handlers.py — diagnostic rule handlers and pattern matchers

For bug reports, feature requests, or documentation improvements, please open an issue or pull request on GitHub.

Disclaimer

This project is an independent community project and is not affiliated with, endorsed by, or maintained by Microsoft.

Azure and Azure Functions are trademarks of Microsoft Corporation.

License

MIT

Release files for azure-functions-doctor 0.19.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for azure-functions-doctor 0.19.2
File Size Uploaded
azure_functions_doctor-0.19.2.tar.gz 5.3 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for azure-functions-doctor 0.19.2
File Interpreter ABI Platform
azure_functions_doctor-0.19.2-py3-none-any.whl Python 3 none any Details

Total release size: 5.3 MB

Release files / azure_functions_doctor-0.19.2.tar.gz

Download URL azure_functions_doctor-0.19.2.tar.gz
Size 5.3 MB
Tags Source
SHA-256 checksum
How to use checksums
61814e1951a9dd08b59ef80235a17675104515f684091194d4d451181b997baf
BLAKE2b-256 checksum
How to use checksums
de2d5815b0b1bc928d60b86ecb04378c2cebbb903f9ec53d2eb9762ca968d284
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 14, 2026.

Transparency log

Release files / azure_functions_doctor-0.19.2-py3-none-any.whl

Download URL azure_functions_doctor-0.19.2-py3-none-any.whl
Size 48.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c41e98a4ea965ab6b2fd9c421d8d593a75230406cf1a325c1674ef437ad62f66
BLAKE2b-256 checksum
How to use checksums
afa73243fd3335974de3fecd5ef1b59da01849e304be9eaa7588f55df2e7e855
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 14, 2026.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page