Hello there 👋! Thank you for showing interest in contributing to azd.
In general, to make contributions a smooth and easy experience, we encourage the following:
- Check existing issues for bugs or enhancements.
- Open an issue if things aren't working as expected, or if an enhancement is being proposed.
- Start a conversation on the issue if you are thinking of submitting a pull request.
- Submit a pull request linked to the issue (e.g., add
Fixes #123to the PR description). PRs without a linked issue will be flagged by our automated checks. Issues in the current milestone get priority review — if yours isn't prioritized yet, tag @rajeshkamal5050 or @kristenwomack and we'll help get it sorted. - The
azdteam will work with you to review the changes and provide feedback. Once the pull request is accepted, a member will merge the changes. Thank you for taking time out of your day to help improve our community!
Prerequisites:
- Go 1.26.1
Build:
cd cli/azd
go buildRun the newly produced azd or azd.exe binary:
- Unix-like systems:
./azd - Windows:
.\azd.exe
Install mage (go install github.com/magefile/mage@latest), then:
cd cli/azd
mage dev:installThis builds azd-dev (to avoid conflicting with a production azd install) with version
info from cli/version.txt and the current git commit, installs it to ~/.azd/bin/, and
automatically adds that directory to your PATH if it isn't already there.
Run all pre-commit checks (formatting, copyright headers, linting, spell check for Go and docs/misc files, build, unit tests) in one command:
cd cli/azd
mage preflightTip: If you're using GitHub Copilot, the
/azd-preflightskill runsmage preflightand auto-fixes any issues it discovers.
Run tests:
go test ./... -shortRun tests (including end-to-end functional tests)
go test ./...Run cspell (install cspell):
# Go source (from cli/azd/)
cspell lint "**/*.go" --relative --config ./.vscode/cspell.yaml
# Docs and misc files (from repo root)
cd ../..
cspell lint "**/*" --relative --config ./.vscode/cspell.misc.yaml
cd cli/azdRun linter (install golangci-lint):
golangci-lint run ./...Run code modernization check (go fix):
go fix -diff ./...If go fix -diff reports any changes, apply them with go fix ./... and commit the result.
CI enforces this check — PRs with pending go fix suggestions will fail the lint workflow.
azd collects coverage from both unit tests and integration/functional tests. Several modes are available depending on your needs.
Working directory: Run all coverage commands from the repository root (not
cli/azd/). The scripts handlecd cli/azdinternally.
| Mode | Command | Mage Target | Prerequisites | Speed |
|---|---|---|---|---|
| Unit only (recommended) | ./eng/scripts/Get-LocalCoverageReport.ps1 -ShowReport -UnitOnly |
mage coverage:unit |
None | ~5-10 min |
| Hybrid (local unit + CI integration) | ./eng/scripts/Get-LocalCoverageReport.ps1 -ShowReport -MergeWithCI |
mage coverage:hybrid |
az login |
~6-11 min |
| Full local (unit + integration) | ./eng/scripts/Get-LocalCoverageReport.ps1 -ShowReport |
mage coverage:full |
Azure subscription + service principal | ~30-60 min |
| CI baseline (latest main) | ./eng/scripts/Get-CICoverageReport.ps1 -ShowReport |
mage coverage:ci |
az login |
~1 min |
Additional mage targets: mage coverage:html (HTML report), mage coverage:check (enforce 50% unit-only threshold; CI gate is 55% combined).
Override the threshold with: COVERAGE_MIN=55 mage coverage:check.
Typical workflow: Use Unit only during development for fast feedback. After pushing a PR, use Hybrid or check your PR's CI coverage with Get-CICoverageReport.ps1 -PullRequestId <N> -ShowReport.
For HTML reports: add -Html to any local command. For threshold checks: add -MinCoverage <N>.
See Code Coverage Guide for architecture details, prerequisites, and troubleshooting.
Note: On Windows you may need to add
C:\Program Files\Git\usr\binto%PATH%
If you don't have a preferred editor for Go code, we recommend Visual Studio Code.
Launch and debug:
- Open VSCode in either
cli/azd(preferred) or in the root directory. - In VSCode, put a breakpoint on the line of code you would like to debug.
- Press F5. Alternatively: Select the "Run and Debug" side pane. With the launch task set to "Debug azd cli", click on the launch button.
- An interactive VSCode prompt should appear. Provide the args for running
azdin this prompt window. Press enter when you're done. azdshould now be running inside the VSCode terminal with the debugger attached.
Launch azd separately, then attach:
- Set
AZD_DEBUG=truein your shell. If this environment variable is set,azdwill pause early in its startup process and allow you to attach to it. - In VSCode, run the launch task "Attach to process".
- Select
azdand press enter. - VSCode debugger should now be attached to the running
azdprocess. - In the shell with
azdrunning, press enter to resume execution.
Tip: Use the VSCode terminal to perform all
azdbuild and run commands.
- Create a new branch:
git checkout -b my-branch-name - Make your change, add tests, and ensure tests pass
- Submit a pull request:
gh pr create --web(install gh cli if needed). Select "Create a fork" to set up a fork for the first time if prompted for.
Windows Security may block execution of unsigned .exe files. This may happen when validating unsigned .exe files produced in a PR build.
> azd version
Access is denied.To fix:
- Run
where azd(cmd) or(Get-Command azd).Source(PowerShell) to get the command path - Click the Start button and type
Windows Security, select and launch the "Windows Security" application - Select
Virus & threat protectiontab on the left side of the window - Click the
Manage settingslink underVirus & threat protection settings - Scroll down in the window to the
Exclusionsheading and click theAdd or remove exclusions link - Select
Add an exclusionand add the path to the exe from step 1