zkt26/sk1/remove-app.sh
2026-05-12 19:27:18 +02:00

37 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# ==========================================
# remove-app.sh — Destroys the entire Azure environment
# ⚠️ Irreversible: all data will be permanently lost
# ==========================================
set -euo pipefail
# ==========================================
# LOGGER — source the shared library
# ==========================================
# shellcheck source=lib/logger.sh
source "$(dirname "$0")/lib/logger.sh" "remove"
trap 'log_error "Failure at line $LINENO. See $LOG_FILE"' ERR
# ==========================================
# VARIABLES
# ==========================================
RESOURCE_GROUP="ExamApp-RG"
log_info "========================================"
log_warn "DESTROYING CLOUD ENVIRONMENT"
log_warn "Resource group: $RESOURCE_GROUP"
log_warn "This will delete: AKS cluster, ACR,"
log_warn "the database disk, and the public IP."
log_warn "DATA CANNOT BE RECOVERED after deletion."
log_info "Log: $LOG_FILE"
log_info "========================================"
# Deletes the entire resource group.
# --yes : skips interactive confirmation
# --no-wait : returns immediately; Azure cleans up in the background
az group delete --name "$RESOURCE_GROUP" --yes --no-wait
log_info "Destruction order sent to Azure."
log_info "Resources will disappear within 5 to 10 minutes."
log_info "Check the Azure Portal to monitor progress."
log_info "========================================"