2.2 - Installation & Commands
Today we cover installing AZD on different platforms and explore the complete command reference to become AZD power users.
What You’ll Learn
Section titled “What You’ll Learn”- How to install AZD on Windows, macOS, and Linux
- Complete AZD command reference
- Configuration and customization options
- Tips and tricks for efficient AZD usage
Resources
Section titled “Resources”Before diving in, review these resources:
- 📘 Install Azure Developer CLI - Official installation guide
- 📘 AZD Command Reference - Complete command documentation
- 📘 AZD Configuration - Customization options
Installation
Section titled “Installation”Windows
Section titled “Windows”Option 1: Windows Package Manager (winget)
winget install microsoft.azdOption 2: PowerShell Script
powershell -ex AllSigned -c "Invoke-RestMethod 'https://aka.ms/install-azd.ps1' | Invoke-Expression"Option 3: MSI Installer Download from aka.ms/azd-windows
Verify Installation:
azd versionOption 1: Homebrew
brew tap azure/azdbrew install azdOption 2: Install Script
curl -fsSL https://aka.ms/install-azd.sh | bashVerify Installation:
azd versionOption 1: Install Script
curl -fsSL https://aka.ms/install-azd.sh | bashOption 2: Package Managers
Ubuntu/Debian:
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bashRHEL/CentOS:
curl -sL https://aka.ms/InstallAzureCLIRPM | sudo bashDev Containers
Section titled “Dev Containers”Add to devcontainer.json:
{ "features": { "ghcr.io/azure/azure-dev/azd:latest": {} }}GitHub Codespaces
Section titled “GitHub Codespaces”Pre-installed in many Azure templates. If not, use install script.
CI/CD Pipelines
Section titled “CI/CD Pipelines”GitHub Actions:
- name: Install azd uses: Azure/setup-azd@v0.1.0Azure Pipelines:
- task: Bash@3 displayName: Install azd inputs: targetType: inline script: | curl -fsSL https://aka.ms/install-azd.sh | bashComplete Command Reference
Section titled “Complete Command Reference”Core Workflow Commands
Section titled “Core Workflow Commands”| Command | Purpose | Example |
|---|---|---|
azd init | Initialize project | azd init --template <template> |
azd up | Provision + Deploy | azd up |
azd provision | Create infrastructure | azd provision |
azd deploy | Deploy application | azd deploy api |
azd down | Delete resources | azd down --force |
Authentication Commands
Section titled “Authentication Commands”| Command | Purpose | Example |
|---|---|---|
azd auth login | Sign in to Azure | azd auth login --use-device-code |
azd auth logout | Sign out | azd auth logout |
azd auth token | Get access token | azd auth token --output json |
Environment Commands
Section titled “Environment Commands”| Command | Purpose | Example |
|---|---|---|
azd env new | Create environment | azd env new prod |
azd env list | List environments | azd env list |
azd env select | Set active environment | azd env select dev |
azd env set | Set variable | azd env set API_KEY "value" |
azd env get-values | Show all variables | azd env get-values |
azd env refresh | Sync environment | azd env refresh |
Monitoring & Troubleshooting
Section titled “Monitoring & Troubleshooting”| Command | Purpose | Example |
|---|---|---|
azd monitor | View telemetry | azd monitor --overview |
azd show | Show app info | azd show |
azd version | Show version | azd version |
azd config | Manage config | azd config list |
Template Commands
Section titled “Template Commands”| Command | Purpose | Example |
|---|---|---|
azd template list | Browse templates | azd template list |
azd template show | Show template details | azd template show <template> |
azd template source add | Add template source | azd template source add <name> <url> |
Infrastructure Commands
Section titled “Infrastructure Commands”| Command | Purpose | Example |
|---|---|---|
azd infra create | Create infra file | azd infra create |
azd infra synth | Generate ARM from Bicep | azd infra synth |
azd infra delete | Delete infrastructure | azd infra delete |
Pipeline Commands
Section titled “Pipeline Commands”| Command | Purpose | Example |
|---|---|---|
azd pipeline config | Configure CI/CD | azd pipeline config |
Command Options & Flags
Section titled “Command Options & Flags”Global Flags
Section titled “Global Flags”Available on all commands:
--cwd <path> # Change working directory--debug # Enable debug logging--no-prompt # Disable interactive prompts--output <format> # Output format: json, table, none--verbose # Verbose loggingExample:
azd provision --debug --output json --no-promptCommon Flags by Command
Section titled “Common Flags by Command”azd init
--template <name> # Template to use--location <region> # Azure region--subscription <id> # Azure subscriptionazd provision
--preview # Show changes without deploying--no-state # Don't save state--no-progress # Disable progress indicatorazd deploy
--service <name> # Deploy specific service--from-package <path> # Deploy from package--all # Deploy all servicesazd down
--force # Skip confirmation--purge # Remove soft-deleted resources--no-wait # Don't wait for completionConfiguration
Section titled “Configuration”Global Configuration
Section titled “Global Configuration”View Configuration:
azd config listSet Values:
azd config set defaults.location eastus
azd config set defaults.subscription <subscription-id>
azd config set telemetry.enabled true
azd config set output.format jsonConfiguration File: ~/.azd/config.json
Project Configuration (azure.yaml)
Section titled “Project Configuration (azure.yaml)”name: my-appmetadata: template: my-app@1.0.0
services: api: project: ./src/api language: python host: containerapp
hooks: postprovision: - echo "Custom hook"
pipeline: provider: githubAliases & Shortcuts
Section titled “Aliases & Shortcuts”Create shell aliases for frequently used commands:
Bash/Zsh (~/.bashrc or ~/.zshrc):
alias azdup='azd up'alias azdp='azd provision'alias azdd='azd deploy'alias azdm='azd monitor --overview'alias azdown='azd down'PowerShell (Profile):
function azdup { azd up }function azdp { azd provision }function azdd { azd deploy }function azdm { azd monitor --overview }function azdown { azd down }Tips & Tricks
Section titled “Tips & Tricks”1. Quick Environment Switching
Section titled “1. Quick Environment Switching”azde() { azd env select $1 azd env get-values}
azde devazde prod2. Preview Before Deploying
Section titled “2. Preview Before Deploying”Always preview infrastructure changes:
azd provision --previewazd provision3. Deploy Specific Service
Section titled “3. Deploy Specific Service”When iterating on code:
azd deploy api # Only deploy APIazd deploy web # Only deploy web4. Check Resource Status
Section titled “4. Check Resource Status”azd show
azd show --open-portal5. Debug Failed Deployments
Section titled “5. Debug Failed Deployments”azd deploy --debug
azd monitor --logs6. Automate with Scripts
Section titled “6. Automate with Scripts”#!/bin/bash
for env in dev test prod; do azd env select $env azd provision azd deploydone7. Use Environment Variables
Section titled “7. Use Environment Variables”azd env set AZURE_LOCATION eastus \ API_PORT 8000 \ LOG_LEVEL DEBUG8. Export Configuration
Section titled “8. Export Configuration”azd env get-values > config.txtShell Completion
Section titled “Shell Completion”Enable tab completion for faster typing:
Bash:
echo 'source <(azd completion bash)' >> ~/.bashrcZsh:
echo 'source <(azd completion zsh)' >> ~/.zshrcPowerShell:
azd completion powershell | Out-String | Invoke-ExpressionVersion Management
Section titled “Version Management”Check Current Version:
azd versionUpdate to Latest:
azd upgradeInstall Specific Version:
winget install microsoft.azd --version 1.5.0
curl -fsSL https://aka.ms/install-azd.sh | bash -s -- --version 1.5.0Uninstallation
Section titled “Uninstallation”Windows:
winget uninstall microsoft.azdmacOS:
brew uninstall azdLinux:
sudo rm $(which azd)Ask Copilot
Section titled “Ask Copilot”Explore AZD commands:
- “What are the performance implications of using ‘—debug’ flag in production deployments?”
- “How do you configure azd to work behind a corporate proxy?”
- “What’s the best practice for managing azd configuration across a team of developers?”
Related Resources
Section titled “Related Resources”Next: Day 10 - Finding Templates
Tomorrow we’ll explore the AZD template gallery and learn how to find the perfect template for your project.