LAB 14 ~60 phút Chương 3 AZ-500 Entra ID P2

Access Review cho Nhóm Admin

Định kỳ rà soát quyền truy cập — tạo Access Review cho group GRP-AZ500-SecurityAdmins, reviewer duyệt/từ chối từng thành viên, auto-apply kết quả để xóa những thành viên không còn phù hợp. Đây là kiểm soát thiết yếu cho compliance và governance.

🎯 Mục Tiêu Lab

Tạo Access Review định kỳ (quarterly) cho group GRP-AZ500-SecurityAdmins

Chỉ định reviewer và cấu hình thời gian review, auto-apply settings

Reviewer đăng nhập và thực hiện review: Approve/Deny từng thành viên với justification

Apply kết quả review — thành viên bị Deny tự động bị xóa khỏi group

Kiểm tra Access Review history và xuất báo cáo compliance

Hiểu các loại Access Review: group membership, Azure role, Entra role, application

🏗️ Kịch Bản

Theo chính sách bảo mật, nhóm Security Admins phải được review mỗi quý. IT Compliance yêu cầu: (1) mọi thành viên phải được chủ động approve, (2) không được để stale accounts trong group, (3) kết quả review phải được lưu trữ cho audit. Đặc biệt chú ý: nhân viên đã chuyển bộ phận hoặc nghỉ việc nhưng vẫn còn trong group admin — đây là rủi ro bảo mật thường bị bỏ sót.

Quarterly Review

Mỗi 90 ngày tự động tạo review mới — không cần nhớ làm thủ công.

Auto-apply

Sau khi review kết thúc, kết quả tự áp dụng — không cần admin can thiệp thủ công.

No response = Deny

Thành viên không được review trong thời hạn sẽ bị xóa — đảm bảo không có exception.

📋 Chuẩn Bị

Yêu cầu:
  • Microsoft Entra ID P2 license
  • Group GRP-AZ500-SecurityAdmins đã tạo (Lab 02) với ít nhất 3–4 members
  • Quyền Identity Governance Administrator hoặc Global Admin
  • User az500-secops01 sẽ làm reviewer
Lưu ý:
  • Access Review nằm trong Microsoft Entra Identity Governance (không phải PIM)
  • Duration review nên đặt ngắn (3–7 ngày trong lab) để test nhanh
  • Reviewer nhận email — cần mailbox hợp lệ
  • Access Review cũng dùng được cho Azure resource roles (ngoài group membership)

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

1

Chuẩn bị Group với đủ thành viên

Thêm đủ thành viên vào group để có thể thực hành approve một số và deny một số.

Cách 2 — Azure CLI
Azure CLI— Xác nhận group và members
# Lấy Object ID của group SecurityAdmins
GROUP_ID=$(az ad group show \
  --group "GRP-AZ500-SecurityAdmins" \
  --query id -o tsv)
echo "Group ID: $GROUP_ID"

# Xem danh sách members hiện tại
az ad group member list \
  --group "GRP-AZ500-SecurityAdmins" \
  --query "[].{name:displayName, upn:userPrincipalName}" \
  --output table

# Thêm user nếu chưa có đủ (cần ít nhất 3-4 members để review)
az ad group member add \
  --group "GRP-AZ500-SecurityAdmins" \
  --member-id $(az ad user show \
    --id [email protected] \
    --query id -o tsv)

az ad group member add \
  --group "GRP-AZ500-SecurityAdmins" \
  --member-id $(az ad user show \
    --id [email protected] \
    --query id -o tsv)
Gợi ý: Thêm az500-dev01 vào group như một thành viên "nhầm" — sau này sẽ Deny và xóa tự động trong bước review.
2

Tạo Access Review

Cách 1 — Portal
  1. 2.1Portal → tìm Microsoft Entra IDIdentity GovernanceAccess reviews
  2. 2.2Click + New access review
  3. 2.3Select what to review: Teams + Groups
  4. 2.4Review scope: All Microsoft 365 groups with guest users → đổi thành Select groups → chọn GRP-AZ500-SecurityAdmins
  5. 2.5Scope: All users (review tất cả members)
  6. 2.6Click Next: Reviews
  7. 2.7Reviewers: Selected users or groups → chọn az500-secops01
  8. 2.8Duration: 7 days (trong lab có thể đặt 3 ngày)
  9. 2.9Review recurrence: Quarterly (mỗi 90 ngày tự tạo review mới)
  10. 2.10Click Next: Settings
Cách 1 — Portal (tiếp theo — Settings tab)
  1. 2.11Bật: Auto apply results to resource ✓ — tự động apply sau khi review xong
  2. 2.12If reviewers don't respond: Remove access — thành viên không được review thì bị xóa
  3. 2.13Bật: Show recommendations ✓ — AI gợi ý Approve/Deny dựa trên sign-in history
  4. 2.14Bật: Require reason on approval
  5. 2.15Click Next: Review + Create → đặt tên: Q1-2026-SecurityAdmins-Review
  6. 2.16Click Create
Cách 2 — Azure CLI
Azure CLI— Tạo Access Review bằng Graph API
# Lấy reviewer ID
REVIEWER_ID=$(az ad user show \
  --id [email protected] \
  --query id -o tsv)

# Tính ngày bắt đầu và kết thúc
START=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
END=$(date -u -d "+7 days" +"%Y-%m-%dT%H:%M:%SZ" 2>/dev/null || \
  date -u -v+7d +"%Y-%m-%dT%H:%M:%SZ")

# Tạo Access Review qua MS Graph API
az rest \
  --method POST \
  --url "https://graph.microsoft.com/v1.0/identityGovernance/accessReviews/definitions" \
  --headers "Content-Type=application/json" \
  --body "{
    \"displayName\": \"Q1-2026-SecurityAdmins-Review\",
    \"descriptionForAdmins\": \"Quarterly review of SecurityAdmins group membership\",
    \"scope\": {
      \"query\": \"/groups/$GROUP_ID/members\",
      \"queryType\": \"MicrosoftGraph\"
    },
    \"reviewers\": [{
      \"query\": \"/users/$REVIEWER_ID\",
      \"queryType\": \"MicrosoftGraph\"
    }],
    \"settings\": {
      \"mailNotificationsEnabled\": true,
      \"reminderNotificationsEnabled\": true,
      \"justificationRequiredOnApproval\": true,
      \"defaultDecisionEnabled\": true,
      \"defaultDecision\": \"Deny\",
      \"instanceDurationInDays\": 7,
      \"autoApplyDecisionsEnabled\": true,
      \"recommendationsEnabled\": true,
      \"recurrence\": {
        \"pattern\": { \"type\": \"absoluteMonthly\", \"interval\": 3 },
        \"range\": { \"type\": \"noEnd\", \"startDate\": \"$(date +%Y-%m-%d)\" }
      }
    }
  }"
3

Reviewer Thực Hiện Review

Đăng nhập bằng az500-secops01 và review từng thành viên trong group.

Cách 1 — Portal (dùng az500-secops01)
  1. 3.1Incognito → đăng nhập az500-secops01
  2. 3.2Truy cập link từ email notification, hoặc: Identity Governance → Access reviews → My access reviews to review
  3. 3.3Click vào Q1-2026-SecurityAdmins-Review
  4. 3.4Thấy danh sách members, AI recommendation bên cạnh (dựa trên sign-in activity)
  5. 3.5Với az500-admin01: click Approve → Reason: "Active admin, confirmed still in Security team"
  6. 3.6Với az500-secops01: click Approve → Reason: "Current Security Ops member"
  7. 3.7Với az500-dev01: click Deny → Reason: "Developer role — should not be in SecurityAdmins group"
  8. 3.8Click Submit để hoàn thành review
Cách 2 — Azure CLI
Azure CLI— Xem pending review decisions
# Đăng nhập az500-secops01 để review
az login --username [email protected]

# Lấy danh sách Access Review definitions
az rest \
  --method GET \
  --url "https://graph.microsoft.com/v1.0/identityGovernance/accessReviews/definitions" \
  --query "value[?displayName=='Q1-2026-SecurityAdmins-Review'].{id:id, status:status}" \
  -o json

# Lưu review definition ID
REVIEW_DEF_ID="YOUR_REVIEW_DEFINITION_ID"

# Xem instances của review
az rest \
  --method GET \
  --url "https://graph.microsoft.com/v1.0/identityGovernance/accessReviews/definitions/$REVIEW_DEF_ID/instances" \
  --query "value[0].{id:id, status:status, start:startDateTime, end:endDateTime}" \
  -o json

INSTANCE_ID="YOUR_INSTANCE_ID"

# Xem tất cả decisions cần review
az rest \
  --method GET \
  --url "https://graph.microsoft.com/v1.0/identityGovernance/accessReviews/definitions/$REVIEW_DEF_ID/instances/$INSTANCE_ID/decisions" \
  --query "value[].{user:principal.displayName, decision:decision, recommendation:recommendation}" \
  -o table
4

Apply Kết Quả Review

Nếu auto-apply đã bật, kết quả áp dụng tự động sau khi review period kết thúc. Với lab, có thể stop và apply ngay.

Cách 1 — Portal (admin account)
  1. 4.1Identity Governance → Access reviews → Q1-2026-SecurityAdmins-Review
  2. 4.2Click vào instance đang active → xem Overview: progress bar review
  3. 4.3Click Stop để kết thúc review sớm (trong lab) → Confirm
  4. 4.4Click Apply results → Confirm
  5. 4.5Chờ 1–2 phút → kiểm tra group: az500-dev01 đã bị xóa khỏi GRP-AZ500-SecurityAdmins
  6. 4.6Kết quả: az500-admin01az500-secops01 vẫn trong group
Cách 2 — Azure CLI
Azure CLI— Xác nhận group membership sau khi apply
# Kiểm tra group membership sau khi apply review
az ad group member list \
  --group "GRP-AZ500-SecurityAdmins" \
  --query "[].{name:displayName, upn:userPrincipalName}" \
  --output table

# Kết quả mong đợi:
# az500-admin01  — còn lại (Approved)
# az500-secops01 — còn lại (Approved)
# az500-dev01    — ĐÃ BỊ XÓA (Denied)

# Xác nhận az500-dev01 không còn trong group
az ad group member check \
  --group "GRP-AZ500-SecurityAdmins" \
  --member-id $(az ad user show \
    --id [email protected] \
    --query id -o tsv)
# → false
Kết quả (Output)— az ad group member list sau khi apply
Name                DisplayName          UserPrincipalName
------------------  -------------------  -----------------------------------------
az500-admin01       AZ500 Admin 01       [email protected]
az500-secops01      AZ500 SecOps 01      [email protected]
5

Xem Review History và Export báo cáo

Cách 1 — Portal
  1. 5.1Identity Governance → Access reviews → tìm review → tab Results
  2. 5.2Xem bảng kết quả: Name, Decision, Reviewed by, Reviewed date, Justification
  3. 5.3Click Download → tải CSV report để lưu cho compliance audit
  4. 5.4Tab History → xem các instances đã hoàn thành (nếu đã có nhiều lần review)
  5. 5.5Kiểm tra Entra ID → Audit logs → lọc Service = Access Reviews để xem toàn bộ events
Cách 2 — Azure CLI
Azure CLI— Xem review decisions và audit log
# Xem toàn bộ decisions của review instance
az rest \
  --method GET \
  --url "https://graph.microsoft.com/v1.0/identityGovernance/accessReviews/definitions/$REVIEW_DEF_ID/instances/$INSTANCE_ID/decisions" \
  --query "value[].{user:principal.displayName, decision:decision, reason:justification, reviewer:reviewedBy.userPrincipalName}" \
  -o table

# Xem audit logs liên quan đến Access Reviews từ Entra ID
az rest \
  --method GET \
  --url "https://graph.microsoft.com/v1.0/auditLogs/directoryAudits?\$filter=loggedByService eq 'Access Reviews'&\$top=20" \
  --query "value[].{time:activityDateTime, activity:activityDisplayName, initiator:initiatedBy.user.userPrincipalName, target:targetResources[0].displayName}" \
  -o table

🧹 Dọn Dẹp Tài Nguyên

Cách 1 — Portal
  1. 1Identity Governance → Access reviews → Q1-2026-SecurityAdmins-Review → click Delete
  2. 2(Optional) Xóa các user test khỏi group, xóa group nếu không dùng tiếp
Cách 2 — Azure CLI
Azure CLI— Xóa Access Review definition
# Xóa Access Review definition (dừng recurring review)
az rest \
  --method DELETE \
  --url "https://graph.microsoft.com/v1.0/identityGovernance/accessReviews/definitions/$REVIEW_DEF_ID"

# Xóa resource group nếu kết thúc toàn bộ chương 3
az group delete \
  --name rg-az500-rbac \
  --yes \
  --no-wait

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

Access Review tạo thành công

Identity Governance → Access reviews hiển thị review với recurrence Quarterly

Review hoàn thành với 3 decisions

2 Approved + 1 Denied với justification đầy đủ từ reviewer az500-secops01

az500-dev01 bị xóa khỏi group

az ad group member check trả về false — auto-apply hoạt động đúng

CSV report xuất được

File CSV chứa đầy đủ decisions, justification, timestamp cho compliance audit

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

1. Nếu reviewer không hoàn thành review trong thời hạn và setting là "Remove access" — điều gì xảy ra?

Gợi ý: Thành viên không được review sẽ tự động bị xóa — đây là cài đặt an toàn nhất vì đảm bảo không có exception do quên.

2. Access Review cho group membership khác gì với Access Review cho Azure resource roles?

Gợi ý: Group membership review kiểm tra ai thuộc group; Azure resource role review kiểm tra ai có role gán trên subscription/RG/resource.

3. "Show recommendations" trong Access Review dựa trên tiêu chí nào?

Gợi ý: Dựa trên sign-in activity — user không đăng nhập trong 30 ngày → AI gợi ý Deny. User active → gợi ý Approve.

4. Ai có thể tạo Access Review trong tổ chức?

Gợi ý: Global Admin, Identity Governance Admin, User Admin (cho group reviews), hoặc Owner của resource (cho resource role reviews).

5. Access Review kết hợp với PIM như thế nào trong thực tế bảo mật doanh nghiệp?

Gợi ý: PIM kiểm soát ai có quyền và khi nào (just-in-time); Access Review kiểm soát ai VẪN CÒN CẦN quyền (periodic recertification). Hai công cụ bổ sung nhau cho vòng đời access management.

Hoàn Thành Chương 3 — RBAC, Custom Roles & PIM

Lab 10: Gán RBAC theo scope, kế thừa quyền

Lab 11: Custom Role với JSON, least privilege

Lab 12: PIM Eligible Assignment, activation policy

Lab 13: PIM Approval Workflow, 4-eyes control

Lab 14: Access Review định kỳ, auto-apply, compliance report

Tiếp tục Chương 4: Enterprise Apps & Managed Identity
Lab 13: PIM Approval Thư viện Labs Lab 15: App Registration
Zalo