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. 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
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, build, unit tests) in one command:
cd cli/azd
mage preflightRun tests:
go test ./... -shortRun tests (including end-to-end functional tests)
go test ./...Run cspell (install cspell):
cspell lint "**/*.go" --relative --config ./.vscode/cspell.yamlRun 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.
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