Azure Essentials | How to run scripts, preflight checks, and deployments
All scripts in this project are run from a terminal (also called a command line or shell). Here's how to open one:
| Platform | How to Open a Terminal |
|---|---|
| VS Code (any OS) | Press Ctrl+` (backtick) or go to Terminal β New Terminal from the menu bar. This is the easiest option! |
| macOS | Open Terminal (search for it in Spotlight with Cmd+Space) |
| Windows | Open PowerShell (search for it in the Start menu) |
| Linux | Open your distro's terminal emulator (usually Ctrl+Alt+T) |
| No install needed | Use Azure Cloud Shell β runs in your browser with all tools pre-installed |
β οΈ Important: Make sure your terminal is in the project root folder (azure_essentials/) before running any command. After cloning, runcd azure_essentialsto get there. If you're using VS Code's built-in terminal, it opens in the project root automatically.What does
./mean? When you see./scripts/bash/deploy.sh, the./means "run this file from the current folder." On Windows, you'll use.\instead (e.g.,.\scripts\powershell\deploy.ps1).
Follow these steps before starting any lesson:
Before deploying anything, validate your environment is properly configured:
| Platform | Command | Description |
|---|---|---|
| macOS | ./scripts/bash/validate-env.sh |
Validates all tools, auth, and Azure access |
| Linux | ./scripts/bash/validate-env.sh |
Same as macOS |
| Windows | .\scripts\powershell\validate-env.ps1 |
PowerShell validation script |
| Cloud Shell | az login && az account show |
Minimal check for Cloud Shell |
# macOS / Linux
chmod +x scripts/bash/validate-env.sh
./scripts/bash/validate-env.sh# Windows (PowerShell)
.\scripts\powershell\validate-env.ps1β Expected Output: All green checkmarks (β) for required tools
scripts/
βββ bash/ # macOS & Linux scripts
β βββ deploy.sh # π Interactive lesson deployment
β βββ validate-env.sh # β
Preflight environment check
β βββ setup-local-tools.sh # π§ Install all required tools
β βββ test-all-lessons.sh # π§ͺ Test all lesson deployments
β βββ test-lessons-e2e.sh # π§ͺ End-to-end lesson validation
β βββ test-deployment.sh # π§ͺ Test a specific deployment
β
βββ powershell/ # Windows scripts
β βββ deploy.ps1 # π Interactive lesson deployment
β βββ validate-env.ps1 # β
Preflight environment check
β βββ setup-local-tools.ps1 # π§ Install all required tools
β βββ test-deploy.ps1 # π§ͺ Quick deployment test
β βββ test-deployment.ps1 # π§ͺ Full deployment test with cleanup
β
βββ azure-cli/ # Pure Azure CLI scripts (any OS)
βββ deploy.sh # π Interactive menu for CLI scripts
βββ lesson-*.sh # Individual lesson scripts
βββ README.md # CLI scripts documentation
βββ commands/ # π Copy-paste command reference
βββ README.md
βββ lesson-*.md # Per-lesson CLI commands
Don't have the tools installed? Run our automated setup:
| Platform | Command |
|---|---|
| macOS | ./scripts/bash/setup-local-tools.sh |
| Linux (Ubuntu/Debian) | ./scripts/bash/setup-local-tools.sh |
| Windows | .\scripts\powershell\setup-local-tools.ps1 |
This installs:
- β
Azure CLI (
az) - β
Azure Developer CLI (
azd) - β Git
- β Python 3.13+
- β kubectl
- β Docker (guided)
- β VS Code extensions
Before teaching, validate that lessons work correctly with live Azure resources:
# Test all lessons (06 + 07)
./scripts/bash/test-lessons-e2e.sh
# Test only Lesson 06 (Linux/MicroK8s)
./scripts/bash/test-lessons-e2e.sh 06
# Test only Lesson 07 (Containers/ACR/Container Apps)
./scripts/bash/test-lessons-e2e.sh 07| What It Tests | Duration | Cost Estimate |
|---|---|---|
| Lesson 06: VM β SSH β MicroK8s β Deploy nginx β NodePort β Browser access | ~10 min | ~$2 |
| Lesson 07: ACR β Build image β Container Apps β Public HTTPS URL | ~8 min | ~$3 |
β οΈ Cost Warning: This creates real Azure resources. Cleanup is offered at the end of the test.
You have three ways to deploy lesson resources:
The easiest way for beginners:
# macOS / Linux
./scripts/bash/deploy.sh
# Windows (PowerShell)
.\scripts\powershell\deploy.ps1This guided script will:
- β Check all prerequisites
- β Let you choose a region (Top 5 North America regions)
- β Select specific lessons to deploy
- β Create separate resource groups per lesson
For more control, use azd directly:
# Authenticate
azd auth login
# Initialize environment
azd init
# Set region and lesson
azd env set AZURE_LOCATION eastus
azd env set LESSON_NUMBER 03 # Deploy Lesson 03 only
# Deploy
azd up
# Clean up when done
azd down --force --purgeLearn the actual Azure CLI commands (great for understanding what's happening):
# Interactive menu
./scripts/azure-cli/deploy.sh
# Or run individual lesson scripts
./scripts/azure-cli/lesson-03-storage.sh
# See the CLI commands without running
./scripts/azure-cli/lesson-03-storage.sh --commands
# Clean up resources
./scripts/azure-cli/lesson-03-storage.sh --cleanupFor Azure Cloud Shell or step-by-step learning, use the copy-paste reference:
- Open Azure Cloud Shell β Select Bash
- Browse to
scripts/azure-cli/commands/ - Open the lesson file (e.g.,
lesson-03-storage.md) - Copy and paste commands one at a time
| Check | Required? | What It Verifies |
|---|---|---|
| Azure CLI | β Yes | az command available and version |
| Azure Developer CLI | β Yes | azd command available |
| Git | β Yes | git available for version control |
| Azure CLI Login | β Yes | Authenticated to Azure subscription |
| azd Login | β Yes | Authenticated for azd deployments |
| Python 3 | π Recommended | For Azure Functions & AI lessons |
| kubectl | π Recommended | For Kubernetes lessons |
| Docker | π Recommended | For container lessons |
| VS Code Extensions | π Optional | Bicep, Azure Tools installed |
β = Passed (green) β All good, no action needed
β = Failed (red) β Required - action needed before continuing
β = Optional (yellow) β Recommended but not blocking
# Azure CLI not authenticated
az login
# Azure Developer CLI not authenticated
azd auth login
# Scripts not executable (macOS/Linux)
chmod +x scripts/bash/*.sh
chmod +x scripts/azure-cli/*.sh
# Docker not running
# macOS/Windows: Start Docker Desktop
# Linux: sudo systemctl start docker| Feature | bash/ scripts |
powershell/ scripts |
azure-cli/ scripts |
|---|---|---|---|
| Platform | macOS, Linux, WSL | Windows | Any (with bash) |
| Method | Azure Developer CLI | Azure Developer CLI | Native az commands |
| Templates | Bicep (declarative) | Bicep (declarative) | None (imperative) |
| Best For | Production-style | Windows users | Learning CLI commands |
| Cloud Shell | β No | β Yes | |
| Dependencies | azd, Bicep | azd, Bicep, PowerShell | Azure CLI only |
Always clean up resources when done to avoid charges:
The deploy scripts have a built-in cleanup option:
# macOS / Linux - Interactive menu (choose 'c' for cleanup)
./scripts/bash/deploy.sh
# macOS / Linux - Direct cleanup command
./scripts/bash/deploy.sh --cleanup
# Non-interactive (for scripting)
./scripts/bash/deploy.sh --cleanup --env azlearn-yourname --yes# Windows - Interactive menu (choose 'c' for cleanup)
.\scripts\powershell\deploy.ps1
# Windows - Direct cleanup command
.\scripts\powershell\deploy.ps1 -Cleanup
# Non-interactive (for scripting)
.\scripts\powershell\deploy.ps1 -Cleanup -Environment azlearn-yourname -Yes# Removes all resources deployed via azd
azd down --force --purge./scripts/azure-cli/lesson-03-storage.sh --cleanup# Delete a specific resource group
az group delete --name rg-yourname-lesson03-storage --yes --no-wait
# List all your resource groups
az group list --query "[?contains(name, 'yourname')].name" -o tsvThe cleanup process removes:
- β All lesson resource groups (rg--lesson)
- β Management groups (if Lesson 02 was deployed)
- β Soft-deleted Key Vaults (purges them)
- β Soft-deleted Cognitive Services (AI Foundry resources)
# macOS / Linux
chmod +x scripts/bash/*.sh
chmod +x scripts/azure-cli/*.sh# macOS / Linux - restart shell or source profile
source ~/.bashrc # or ~/.zshrc
# Windows - restart PowerShell terminal# Clear cached credentials
az logout
az account clear
# Login again
az login# Check current status
azd show
# Debug mode for more info
azd up --debug
# If stuck, force cleanup and retry
azd down --force --purge
azd up- Prerequisites & Setup Guide β Detailed installation instructions
- Lesson Index β Navigate all course lessons
- Azure CLI Commands Reference β Copy-paste commands
- Main README β Course overview
Happy Learning! π