azd hooks run supports per-layer hooks
Introduced 2026-04-04 · score 0.97
HOW TO USE IT
When a project defines infrastructure layers, put the hook under `infra.layers[].hooks` in `azure.yaml` to run it during `azd provision`. To run a named hook for one layer, use `azd hooks run <hook-name> --layer <layer-name>`.
azd hooks run <hook-name> --layer <layer-name>infra:
layers:
- name: <layer-name>
path: <infra-path>
hooks:
postprovision:
shell: sh
run: <script-path>WHY THIS HELPS
Run hooks for a specific infrastructure layer or configure hooks to run during provisioning.
REQUIREMENTS AND LIMITATIONS
- Version: 1.23.14
- <hook-name> (required): Name of the hook to run.
- --layer <layer-name>: Restricts execution to the specified provisioning layer.
- infra.layers[].name (required): Name of the provisioning layer.
- infra.layers[].path (required): Path to the layer's IaC templates.
- infra.layers[].hooks.<event>: Hook definition for a lifecycle event, such as `postprovision`; hook definitions support `run` and optional `shell`.
- Prerequisite: Install `azd`. The docs specify no additional prerequisite for layer hooks or `azd hooks run --layer`.
FIRST-PARTY EVIDENCE
- https://github.com/Azure/azure-dev/releases/tag/azure-dev-cli_1.23.14
- https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/reference
- https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/layered-provisioning
- 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