Government IT teams rarely standardize on a single programming language. Your infrastructure team writes PowerShell, your data engineers prefer Python, your web developers think in TypeScript, and your line-of-business app team builds everything in .NET. Until now, Azure Developer CLI (azd) hooks forced everyone into the same box: Bash or PowerShell. That changed with the April 2026 releases of azd 1.23.15 and 1.24.0, which introduced polyglot hook support for Python, JavaScript, TypeScript, and C#/.NET.
This post walks through the new hook system with concrete examples relevant to government deployment workflows, including compliance checks, environment validation, and post-deployment verification.
What Are azd Hooks?
The Azure Developer CLI uses a lifecycle-based hook system that lets you execute custom scripts before and after key deployment commands. Hooks follow a pre/post naming convention tied to azd commands:
| Hook | Trigger |
|---|---|
preprovision / postprovision | Before/after Azure resources are created |
predeploy / postdeploy | Before/after application code is deployed |
preup / postup | Before/after the combined provision + deploy pipeline |
predown / postdown | Before/after resources are torn down |
prerestore / postrestore | Before/after package dependencies are restored |
Hooks are registered in your azure.yaml file at the project root or scoped to individual services. Previously, you could only set shell: sh or shell: pwsh. Now, azd auto-detects the language from the file extension of your hook script, no shell declaration needed.
For the full hook reference, see the azd extensibility documentation.
What Changed: Language Support Across Two Releases
azd 1.23.15 (April 10, 2026)
- Python hooks: Point a hook’s
run:field at a.pyfile and azd auto-detects it. When arequirements.txtorpyproject.tomlis present in the hook directory, azd automatically creates a virtual environment and installs dependencies before execution. - JavaScript hooks:
.jsfiles are auto-detected and executed withnode. When apackage.jsonis present, azd runsnpm installautomatically. - TypeScript hooks:
.tsfiles execute vianpx tsxwith zero compile step required. Samepackage.jsonauto-install behavior as JavaScript.
azd 1.24.0 (April 14, 2026)
- C#/.NET hooks:
.csfiles are auto-detected and executed usingdotnet run. azd discovers.csprojfiles via walk-up search and supports single-file C# scripts on .NET 10+. - Executor-specific
config:block: Fine-grained control per language, includingpackageManagerfor JS/TS hooks (npm, pnpm, or yarn),virtualEnvNamefor Python hooks, andconfiguration/frameworkfor .NET hooks.
Sources: azd 1.23.15 release notes, azd 1.24.0 release notes
Hands-On: Government Deployment Hooks in Four Languages
Let’s build a realistic azure.yaml configuration for a government application that uses hooks in every supported language.
The Scenario
Your agency deploys a citizen services portal to Azure. Before provisioning, you need to validate that the target subscription meets your compliance requirements. After provisioning, you seed a database. After deployment, you run smoke tests and generate an audit report.
Project Structure
| |
azure.yaml Configuration
| |
Notice there is no shell: declaration on any hook. azd infers the executor from the file extension: .py runs Python, .cs runs .NET, .ts runs TypeScript via npx tsx, and .js runs JavaScript via node.
Hook 1: Python Pre-Provision Compliance Check
hooks/validate-subscription.py
| |
hooks/requirements.txt
| |
azd automatically creates the compliance_venv virtual environment (using the name from the config: block) and installs any dependencies listed in requirements.txt before running the script.
Hook 2: .NET Post-Provision Database Seeding
hooks/seed-database.cs
| |
With the config: block set to configuration: Release and framework: net8.0, azd runs dotnet restore, dotnet build -c Release -f net8.0, and then dotnet run --no-build --project <discovered-csproj>. For teams on .NET 10+, single-file .cs scripts work without a .csproj at all.
Hook 3: TypeScript Post-Deploy Smoke Tests
hooks/smoke-tests.ts
| |
TypeScript hooks execute through npx tsx, which means zero compilation step. You write .ts, azd runs .ts. The package.json in the hooks directory can declare dependencies like any Node project, and azd runs npm install (or pnpm/yarn if configured) during the Prepare phase.
Hook 4: JavaScript Post-Up Audit Report
hooks/generate-audit-report.js
| |
Running and Testing Hooks Independently
azd 1.24.0 also supports running hooks in isolation for testing, which is especially useful when building out compliance automation:
| |
This makes it straightforward to iterate on hook logic in a development environment before promoting to production.
Platform-Specific Overrides
Government teams often have mixed Windows and Linux development environments. Polyglot hooks support platform-specific overrides:
| |
Integrating with CI/CD Pipelines
Hooks execute in CI/CD pipelines exactly as they do locally. When you run azd pipeline config to set up GitHub Actions or Azure Pipelines, your hooks run as part of the azd up or azd deploy steps in the pipeline. This means your compliance checks, smoke tests, and audit reporting run automatically on every deployment, not just when a developer remembers to run them.
Why This Matters for Government
Meet teams where they are. Government IT organizations are rarely single-language shops. Your security team might maintain compliance scripts in Python, your platform team automates in PowerShell, and your application developers build in .NET or TypeScript. Polyglot hooks eliminate the friction of translating automation logic into a language the tool supports.
Codify compliance as deployment gates. The preprovision hook pattern shown above turns compliance validation into an automated gate that runs before any resources are created. Region restrictions, resource provider checks, naming convention enforcement, and policy validation can all be expressed in the language your compliance team already knows.
Auditable deployment trails. Government agencies face audit requirements that commercial organizations do not. The postup hook pattern generates structured audit records for every deployment, capturing who deployed, when, where, and to which environment, all without manual documentation.
Consistent across environments. Whether your team deploys to Azure Commercial (East US, Central US) or Azure Government (US Gov Virginia, US Gov Arizona), azd hooks work identically. The CLI is a client-side tool, so there are no cloud-side feature availability concerns.
Lower the barrier to infrastructure automation. Many government developers are not shell scripting experts. Letting them write deployment hooks in Python, TypeScript, or C# means more teams can participate in building deployment automation, reducing bottlenecks on the one person who knows Bash.
Getting Started
Install or update azd to version 1.24.0 or later:
1winget upgrade microsoft.azdOr on Linux/macOS:
1curl -fsSL https://aka.ms/install-azd.sh | bashAdd hooks to your
azure.yamlusing the examples above as templates.Test hooks independently with
azd hooks run <hook-name>before running full deployments.Review the official documentation at Customize your azd workflows using hooks.
Polyglot hooks are a small feature with outsized impact. They turn azd from a deployment tool into a deployment platform where your entire team, regardless of language preference, can contribute to automated, compliant, auditable cloud deployments.
