azd azure.yaml hooks support Python scripts
Introduced 2026-04-11 · score 0.93
HOW TO USE IT
When an `azure.yaml` hook runs a `.py` file, `azd` detects Python from the extension and runs the script. If `requirements.txt` or `pyproject.toml` is in the script’s directory or a parent directory, `azd` creates a virtual environment and installs dependencies.
hooks:
preprovision:
run: ./hooks/setup.pyWHY THIS HELPS
Run an `azure.yaml` hook implemented as a Python script in the project.
REQUIREMENTS AND LIMITATIONS
- Version: 1.23.15
- hooks.<event>.run (required): Inline script or relative script path; `.py` extension enables Python detection.
- hooks.<event>.kind: Executor kind; allowed values include `python`. Omit for extension-based detection.
- hooks.<event>.config.virtualEnvName: Python virtual environment directory name override.
- Prerequisite: Install `azd` and Python 3.x.
- Prerequisite: For automatic dependency installation, put `requirements.txt` or `pyproject.toml` in the script directory or a parent directory.
FIRST-PARTY EVIDENCE
- https://github.com/Azure/azure-dev/releases/tag/azure-dev-cli_1.23.15
- https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/hooks-multi-language
- https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/azd-schema
Check the installed version and the source before using it. Entry JSON