AZ-500 LAB 45 ~60 phút Chương 11 Defender for Cloud

Bật Defender for Cloud + Secure Score

Bật Microsoft Defender for Cloud, kích hoạt Defender plans cho subscription, đọc và phân tích Secure Score, drill-down vào Security Controls, thực hiện ít nhất một quick-win remediation và theo dõi điểm thay đổi.

🎯 Mục Tiêu Lab

Mở Defender for Cloud và xem trạng thái coverage ban đầu

Bật Defender plans: Servers, Storage, Databases (free trial 30 ngày)

Đọc Secure Score: điểm tổng, phân tích theo Security Controls

Drill-down vào top recommendations, hiểu severity và max score gain

Thực hiện ít nhất 1 quick-fix remediation (ví dụ: bật MFA, bật TDE)

Xem Inventory và hiểu Resource Health trong Defender for Cloud

📋 Chuẩn Bị

Yêu cầu:
  • Quyền Security Admin hoặc Subscription Contributor
  • Defender for Cloud được cung cấp miễn phí ở tầng cơ bản (CSPM)
  • Defender plans (Servers, Storage...) có trial 30 ngày miễn phí
  • Lab thiên về Portal — CLI dùng để kiểm tra và tự động hóa
Kiến trúc Defender for Cloud:
CSPMCloud Security Posture Management — Secure Score, Recommendations (miễn phí)
CWPCloud Workload Protection — Defender plans bảo vệ Server, DB, Storage (trả phí)
DCSPMDefender CSPM nâng cao — Attack path, Cloud Security Explorer (trả phí)

🏗️ Kịch Bản

CISO yêu cầu đánh giá toàn bộ Azure subscription theo điểm Secure Score để xác định ưu tiên cải thiện bảo mật. Bạn là Azure Security Engineer, cần bật Defender for Cloud, phân tích điểm hiện tại, xác định top 3 cải tiến có impact cao nhất (cao Max Score Gain), thực hiện ít nhất 1 remediation và báo cáo kết quả thay đổi Secure Score cho CISO.

🧪 Các Bước Thực Hiện

1

Mở Defender for Cloud và xem Coverage

Cách 1 — Portal (chính)
  1. 1.1Portal → tìm "Microsoft Defender for Cloud" → click vào
  2. 1.2Overview → xem: Secure score, Active recommendations, Assessed resources
  3. 1.3Left menu → Management → Environment settings → click vào subscription của bạn
  4. 1.4Xem Defender plans: các plan nào đang OFF (màu xám) → ghi nhận để bật ở bước 2
Cách 2 — Azure CLI
Azure CLI— Bash / Cloud Shell
SUBSCRIPTION_ID=$(az account show --query id -o tsv)

# Xem trạng thái Defender plans hiện tại
az security pricing list \
  --output table \
  --query "[].{Name:name, PricingTier:pricingTier}"
2

Bật Defender Plans

Cách 1 — Portal (chính)
  1. 2.1Environment settings → Defender plans → bật Servers (Plan 1 — $5/server/tháng, trial 30 ngày)
  2. 2.2Bật Storage → bật Databases (chọn Azure SQL databases)
  3. 2.3Bật Key VaultResource Manager (miễn phí)
  4. 2.4Click Save → chờ 5–10 phút để Defender bắt đầu scan
Chi phí trial: Defender plans có free trial 30 ngày. Sau trial sẽ tính phí. Tắt trước khi hết 30 ngày nếu chỉ dùng cho lab.
Cách 2 — Azure CLI
Azure CLI— Bash / Cloud Shell
# Bật Defender for Servers (Plan 1)
az security pricing create \
  --name VirtualMachines \
  --tier Standard \
  --subplan P1

# Bật Defender for Storage
az security pricing create \
  --name StorageAccounts \
  --tier Standard

# Bật Defender for SQL (Azure SQL)
az security pricing create \
  --name SqlServers \
  --tier Standard

# Bật Defender for Key Vault
az security pricing create \
  --name KeyVaults \
  --tier Standard

# Xác nhận các plans đã bật
az security pricing list \
  --query "[?pricingTier=='Standard'].{Name:name, Tier:pricingTier}" \
  --output table
3

Phân tích Secure Score

Cách 1 — Portal (chính)
  1. 3.1Defender for Cloud → Secure score (left menu)
  2. 3.2Đọc Overall secure score (ví dụ: 45% = 45/100) — mục tiêu đạt 70%+
  3. 3.3Scroll xuống xem Security controls — mỗi control có: Current score / Max score / Resources affected
  4. 3.4Xác định top 3 controls có Max score gain cao nhất — đây là ưu tiên cải thiện
  5. 3.5Click vào 1 control → xem các recommendations bên trong → chọn recommendation có "Quick fix" label
Cách 2 — Azure CLI
Azure CLI— Bash / Cloud Shell
# Xem Secure Score hiện tại của subscription
az security secure-score list \
  --query "[].{name:name, score:score.current, max:score.max, percentage:score.percentage}" \
  --output table

# Xem danh sách Security Controls và điểm
az security secure-score-controls list \
  --query "[].{control:displayName, current:score.current, max:score.max, resources:unhealthyResourceCount}" \
  --output table

# Xem top recommendations (High severity trước)
az security assessment list \
  --query "[?status.code=='Unhealthy'] | sort_by(@, &metadata.severity) | [0:10].{name:displayName, severity:metadata.severity, remediation:metadata.remediationDescription}" \
  --output table
Output mẫu — Secure Score
Name                   Score    Max    Percentage
---------------------  -------  -----  ----------
ascScore               38.00    100    38.00%

# Security Controls (ví dụ)
Control                              Current  Max  Resources
-----------------------------------  -------  ---  ---------
Enable MFA                           0        10   3
Remediate security configurations    2        4    12
Apply system updates                 0        6    5
Restrict unauthorized network access 1        4    8
4

Thực hiện Remediation từ Recommendations

Cách 1 — Portal (chính)
  1. 4.1Defender for Cloud → Recommendations → filter: Severity = High
  2. 4.2Chọn recommendation có nhãn "Quick fix" (biểu tượng tia chớp) — ví dụ: "Enable MFA for accounts with write permissions"
  3. 4.3Click vào recommendation → xem: Description, Remediation steps, Affected resources
  4. 4.4Tab Take action → nếu có Quick fix → click "Fix" hoặc làm theo Remediation steps thủ công
  5. 4.5Sau khi fix → chờ 15–30 phút → quay lại Secure Score → xem điểm tăng
Quick-win recommendations phổ biến (không tốn phí):
  • Enable MFA for accounts with write permissions — Max gain +10 pts
  • Subscriptions should have a contact email for security issues — Quick fix
  • Enable Microsoft Defender for Cloud on subscription — Quick fix
  • SQL databases should have transparent data encryption enabled — Quick fix
Cách 2 — Azure CLI (ví dụ: thêm security contact)
Azure CLI— Bash / Cloud Shell
# Remediation 1: Thêm Security Contact (quick win phổ biến)
az security contact create \
  --name "security-contact-lab" \
  --email "[email protected]" \
  --alert-notifications On \
  --alerts-to-admins On \
  --phone "+84-917-516-878"

# Remediation 2: Đảm bảo auto provisioning của monitoring agent bật
az security auto-provisioning-setting update \
  --name "mma" \
  --auto-provision On

# Remediation 3: Bật Defender for Cloud notifications
az security contact show --name "security-contact-lab"

# Xem Secure Score sau remediation (sau 15-30 phút)
az security secure-score list \
  --query "[0].{score:score.current, percentage:score.percentage}"
5

Xem Inventory và Resource Health

Cách 1 — Portal (chính)
  1. 5.1Defender for Cloud → Inventory (left menu)
  2. 5.2Xem danh sách resources và Health status: Healthy / Unhealthy / Not applicable
  3. 5.3Filter: Unhealthy → click vào resource → xem Recommendations áp dụng cho resource đó
  4. 5.4Xem Security alerts (nếu có) — Defender plans phát hiện anomaly sau khi bật
Cách 2 — Azure CLI
Azure CLI— Bash / Cloud Shell
# Xem tất cả resources và trạng thái health
az security assessment list \
  --query "[].{resource:resourceDetails.id, status:status.code, displayName:displayName}" \
  --output table | head -20

# Xem security alerts (nếu Defender plans đã scan)
az security alert list \
  --query "[].{name:alertDisplayName, severity:severity, status:status, time:startTimeUtc}" \
  --output table

# Tổng hợp: đếm theo trạng thái
az security assessment list \
  --query "
  {
    healthy: [?status.code=='Healthy'] | length(@),
    unhealthy: [?status.code=='Unhealthy'] | length(@),
    notApplicable: [?status.code=='NotApplicable'] | length(@)
  }"

🧹 Dọn Dẹp — Tắt Defender Plans

Quan trọng: Tắt Defender plans trong 30 ngày trial để tránh phát sinh phí. Free tier CSPM (Secure Score, Recommendations) vẫn hoạt động sau khi tắt plans.
Azure CLI
# Tắt các Defender plans (trả về Free tier)
az security pricing create --name VirtualMachines --tier Free
az security pricing create --name StorageAccounts --tier Free
az security pricing create --name SqlServers --tier Free
az security pricing create --name KeyVaults --tier Free

# Xác nhận tất cả về Free
az security pricing list \
  --query "[].{Name:name, Tier:pricingTier}" --output table

📊 Kết Quả Đầu Ra Lab 45

Defender plans bật

az security pricing list → Servers, Storage, SQL = Standard

Secure Score đọc được

Có điểm % cụ thể, hiểu cách tính và security controls

Remediation hoàn thành

Ít nhất 1 quick-win recommendation được xử lý

Inventory xem được

Phân loại resource Healthy/Unhealthy, xem alerts nếu có

❓ Câu Hỏi Ôn Tập

1. Secure Score 60% nghĩa là gì? Làm sao để tăng lên 70%?

Gợi ý: 60% = đang thực hiện 60/100 điểm best practices. Tăng bằng cách thực hiện recommendations có Max Score Gain cao, ưu tiên High severity, dùng Quick Fix.

2. CSPM và CWP (Defender plans) khác nhau thế nào về chức năng và chi phí?

Gợi ý: CSPM miễn phí = posture management, recommendations, Secure Score. CWP trả phí = real-time threat protection, alerts, vulnerability scanning cho workloads.

3. Khi nào nên "Exempt" một recommendation thay vì remediate?

Gợi ý: Exempt khi: risk được accept, mitigated bằng cách khác, không áp dụng cho workload này. Exempt không tăng score nhưng loại khỏi non-compliant list.

4. Security Contact trong Defender for Cloud dùng làm gì?

Gợi ý: Email nhận alert khi Defender phát hiện threat. Microsoft cũng gửi thông báo bảo mật quan trọng cho email này. Không có contact = miss critical alerts.

5. Điểm Secure Score tăng ngay sau remediation không? Bao lâu thì cập nhật?

Gợi ý: Không ngay — Defender cần 15–30 phút để re-evaluate. Một số recommendation phức tạp (như MFA) cần 24h để reflect. Score update thường mỗi 24h.

Lab 44: Resource Lock + Backup Vault Thư viện Labs Lab 46: Regulatory Compliance
Zalo