Run scripts with azd environment context
azd exec ./script.sh Database migrations, setup automation, CI/CD workflows - with seamless access to Azure credentials and Key Vault secrets.
Security Notice
IMPORTANT: azd exec executes scripts with full access to your Azure credentials and environment.
Only run scripts you trust and have reviewed. Never pipe untrusted scripts from the internet.
Everything You Need
Multiple Shell Support
Automatically detects and runs bash, sh, zsh, PowerShell, pwsh, and cmd scripts based on file extension or shebang.
Script Arguments
Pass arguments to your scripts seamlessly with the -- separator for clean parameter handling.
Full Azure Context
Access all azd environment variables including subscription, tenant, location, and custom variables.
Working Directory Control
Execute scripts from any directory with the global --cwd flag for flexible automation.
Interactive Mode
Run scripts with interactive input support for prompts and user interaction.
Azure Key Vault Integration
Automatically resolves Key Vault references in environment variables, securely fetching secrets at runtime without hardcoding credentials.
Battle-Tested
Comprehensive security scanning with CodeQL and gosec (0 vulnerabilities). 86%+ test coverage.
Quick Start
Install Extension
# Install Azure Developer CLIwinget install microsoft.azd
# Enable extensionsazd config set alpha.extension.enabled on
# Add extension sourceazd extension source add -n azd-exec -t url -l https://raw.githubusercontent.com/jongio/azd-exec/main/registry.json
# Install extensionazd extension install jongio.azd.exec# Install Azure Developer CLIbrew tap azure/azd && brew install azd
# Enable extensionsazd config set alpha.extension.enabled on
# Add extension sourceazd extension source add -n azd-exec -t url -l https://raw.githubusercontent.com/jongio/azd-exec/main/registry.json
# Install extensionazd extension install jongio.azd.exec# Install Azure Developer CLIcurl -fsSL https://aka.ms/install-azd.sh | bash
# Enable extensionsazd config set alpha.extension.enabled on
# Add extension sourceazd extension source add -n azd-exec -t url -l https://raw.githubusercontent.com/jongio/azd-exec/main/registry.json
# Install extensionazd extension install jongio.azd.execVerify Installation
azd exec versionRun Your Script
# Review the script firstcat ./run-migration.sh
# Then executeazd exec ./run-migration.shExample Scripts
Bash Script
#!/bin/bashecho "Running database migration for: $AZURE_ENV_NAME"
# Get database connection string from Azure SQLCONN_STRING=$(az sql db show-connection-string \ --server "sql-$AZURE_ENV_NAME" \ --name "db-$AZURE_ENV_NAME" \ --client sqlcmd -o tsv)
# Run migration using sqlcmd or your migration toolsqlcmd -S "sql-$AZURE_ENV_NAME.database.windows.net" \ -d "db-$AZURE_ENV_NAME" \ -G -i ./migrations/001_add_users_table.sql
echo "Migration completed!"PowerShell Script
Write-Host "Environment: $env:AZURE_ENV_NAME"Write-Host "Resource Group: $env:AZURE_RESOURCE_GROUP"
# Your setup logic hereReady to get started?
Install azd exec and start running your scripts with Azure context.
Get Started Now