Microsoft Entra ID — User Guide
Microsoft Entra ID — User Guide
| Pack name | Microsoft Entra ID |
| Version | 1.0.4 |
| Vendor | Microsoft |
| Capabilities | Connector (×2) · Transformation · Streaming Rules · Correlation Rules · Dashboard |
| Categories | Identity · Cloud · Authentication · Azure · Identity and Access Management |
Overview
Pack cung cấp giám sát bảo mật Microsoft Entra ID (Azure Active Directory) trên SecOps platform, bao gồm:
- 2 pull connector qua Microsoft Graph API
entraid-log— thu thập sign-in logs + directory audit logs (collection)entraid-entity— đồng bộ user & device làm dữ liệu enrichment
- Transformation — chuẩn hóa 2 luồng log (sign-in + directory audit) sang ECS, kèm block
#enrichmentbổ sung thông tin user từ entity store - 8 streaming rules — sign-in failure, tạo/xóa user, thao tác directory thất bại, thay đổi admin role, thêm credential cho service principal, sửa Conditional Access policy, thêm federated domain
- 5 correlation rules — brute force, password spray, impossible travel, bulk user deletion, brute force rồi đăng nhập thành công
- 1 dashboard — 12 chart giám sát SOC authentication và directory operations
Yêu cầu trước khi cài đặt
| Yêu cầu | Chi tiết |
|---|---|
| Entra ID license | P1 hoặc P2 — Graph API auditLogs/signIns yêu cầu license này |
| App Registration | Tạo app trong Entra ID → App registrations, sinh Client secret |
| Graph API permission (log) | Application permission: AuditLog.Read.All, Directory.Read.All — bấm Grant admin consent |
| Graph API permission (entity) | Application permission: User.Read.All, Device.Read.All — bấm Grant admin consent |
| Thông tin cần lấy | Directory (tenant) ID · Application (client) ID · Client secret value (không phải secret ID) |
| Quyền platform | Role Content Pack Manager để cài pack, Log Source Manager để tạo connector |
Connector dùng OAuth2 client credentials flow tới
https://login.microsoftonline.com/<tenant_id>/oauth2/v2.0/tokenvới scopehttps://graph.microsoft.com/.default. Không cần Event Hub, Log Analytics hay log shipper ngoài.
Cài đặt
- Vào Marketplace → tìm "Microsoft Entra ID" → Install
- Vào Data Collection → Data Connectors → Add Connection → chọn connector type
entraid-log→ điền cấu hình → Test Connection → Save - (Tùy chọn, khuyến nghị) Thêm log source thứ hai với connector type
entraid-entityđể bật enrichment user/device - Kiểm tra Transformations →
entra-id-parserđang active - Kiểm tra Detection Rules → filter tag entra_id → 13 rules đang enabled
- Mở Dashboards → Entra ID Security Overview
Cấu hình entraid-log (collection)
| Field | Key | Kiểu | Bắt buộc | Mặc định | Mô tả |
|---|---|---|---|---|---|
| Tenant ID | tenant_id | string | ✅ | — | Directory (tenant) ID |
| Application (Client) ID | client_id | string | ✅ | — | Client ID của App Registration |
| Client Secret | client_secret | password | ✅ | — | Giá trị client secret |
| Initial Lookback Hours | lookback_hours | int | — | 1 | Số giờ lấy ngược lại ở lần chạy đầu (chưa có watermark) |
| Poll Interval (minutes) | time_interval | int | ✅ | 5 | Chu kỳ gọi Graph API |
Cấu hình entraid-entity (enrichment)
| Field | Key | Kiểu | Bắt buộc | Mô tả |
|---|---|---|---|---|
| Entra Tenant ID | tenant_id | string | ✅ | Directory (tenant) ID |
| Client ID | client_id | string | ✅ | Client ID của App Registration |
| Client Secret | client_secret | password | ✅ | Giá trị client secret |
| Poll Interval (minutes) | time_interval | int | ✅ | Chu kỳ đồng bộ, khuyến nghị 60 |
Khi đẩy cấu hình qua API, kiểu dữ liệu phải khớp chính xác:
tenant_id/client_id/client_secretlà chuỗi có nháy,time_interval/lookback_hourslà số không nháy.
Cách connector hoạt động
entraid-log — sign-in & directory audit
| Luồng | Endpoint Graph | Bộ lọc | Nhãn gắn vào record |
|---|---|---|---|
| Sign-in | GET /v1.0/auditLogs/signIns | $filter=createdDateTime ge <since>, $top=1000 | _log_type = "signin" |
| Directory audit | GET /v1.0/auditLogs/directoryAudits | $filter=activityDateTime ge <since>, $orderby=activityDateTime asc, $top=1000 | _log_type = "directoryaudit" |
- Phân trang theo
@odata.nextLinkcho tới hết idem_key={instance_id}:signin:{id}/{instance_id}:directoryaudit:{id}→ không nhân bản event- Watermark chỉ được đẩy sau khi yield hết cả 2 luồng, lấy giá trị timestamp lớn nhất quan sát được
entraid-entity — user & device
| Entity | Endpoint Graph | @entity_type |
|---|---|---|
| User | GET /v1.0/users | user |
| Device | GET /v1.0/devices | device |
Header ConsistencyLevel: eventual được set sẵn để hỗ trợ advanced query của Graph. Đây là connector data_kind = enrichment → đồng bộ lại toàn bộ mỗi chu kỳ, không dùng watermark.
Field user đồng bộ: id, displayName, givenName, surname, userPrincipalName, userType, mail, otherMails, mailNickname, businessPhones, mobilePhone, jobTitle, department, officeLocation, accountEnabled, usageLocation, passwordPolicies, signInSessionsValidFromDateTime, createdDateTime, lastPasswordChangeDateTime.
Field device đồng bộ: id, deviceId, displayName, operatingSystem, operatingSystemVersion, deviceVersion, trustType, profileType, accountEnabled, approximateLastSignInDateTime, registrationDateTime.
Định dạng log
Pack có 2 transformation cho 2 con đường thu thập khác nhau — chọn nhầm sẽ khiến toàn bộ field trống.
| Transformation | Áp dụng khi | Field phân biệt luồng | Giá trị |
|---|---|---|---|
connectors/entraid-log/parser.yaml | Dùng connector entraid-log (tự động gắn theo connector type) | _log_type | signin · directoryaudit |
parsers/entra-id-parser.yaml | Đẩy log bằng shipper ngoài (Event Hub + Logstash, Log Analytics + Filebeat…) | _source | entra_id_signin · entra_id_directoryaudit |
Ví dụ log hợp lệ (đường shipper ngoài — dùng _source)
Sign-in thành công:
{"_source":"entra_id_signin","id":"a1b2c3d4-0000-1111-2222-333344445555","timestamp":"2026-01-15T07:20:01.305Z","isInteractive":true,"conditionalAccessStatus":"success","userPrincipalName":"user@example.com","userDisplayName":"Nguyen Van A","userId":"aaaabbbb-cccc-dddd-eeee-ffffgggghhhh","ipAddress":"203.0.113.42","appDisplayName":"Microsoft Azure Portal","clientAppUsed":"Browser","resourceDisplayName":"Windows Azure Service Management API","riskState":"none","location":{"countryOrRegion":"VN","city":"Hanoi"},"deviceDetail":{"operatingSystem":"Windows 10","browser":"Edge 120.0","isCompliant":true,"isManaged":true},"status":{"errorCode":0}}
Sign-in thất bại:
{"_source":"entra_id_signin","id":"b2c3d4e5-1111-2222-3333-444455556666","timestamp":"2026-01-15T07:21:00.000Z","isInteractive":true,"conditionalAccessStatus":"failure","userPrincipalName":"admin@example.com","ipAddress":"198.51.100.22","appDisplayName":"Microsoft Azure Portal","location":{"countryOrRegion":"RU"},"status":{"errorCode":50126,"failureReason":"Invalid username or password"}}
Directory audit — xóa user:
{"_source":"entra_id_directoryaudit","id":"Directory_ABCD1234","timestamp":"2026-01-15T07:30:00.000Z","activityDateTime":"2026-01-15T07:30:00.123456Z","activityDisplayName":"Delete user","category":"UserManagement","operationType":"Delete","loggedByService":"Core Directory","correlationId":"corr-uuid-1234","result":"success","initiatedBy":{"user":{"id":"admin-uuid","userPrincipalName":"admin@example.com"}},"targetResources":[{"id":"victim-uuid","userPrincipalName":"victim@example.com","type":"User"}]}
⚠️ Cả 2 transformation đều lấy
timestampcuối cùng từ field.timestampở cấp gốc với format cố định%Y-%m-%dT%H:%M:%S.%3fZ(đúng 3 chữ số millisecond). Log thiếu field này hoặc sai độ chính xác sẽ bị drop toàn bộ event.
Transformation — Các trường ECS chính
| ECS Field | Nguồn (sign-in) | Nguồn (directory audit) | Mô tả |
|---|---|---|---|
event.module | cố định | cố định | Luôn là entra_id |
event.dataset | entra_id.signin | entra_id.directoryaudit | Phân biệt 2 luồng |
event.category | authentication | iam | Điều kiện chính của rule |
event.action | interactive_signin / non_interactive_signin (theo isInteractive) | activityDisplayName hạ chữ thường, thay space bằng _ (delete_user, add_user, add_member_to_role…) | Hành động |
event.outcome | conditionalAccessStatus → success / failure / unknown | result → success / failure / unknown | Kết quả |
event.id | id | id | ID sự kiện |
user.id | userId | — | Object ID user |
user.email | userPrincipalName | targetResources[0].userPrincipalName, fallback initiatedBy.user.userPrincipalName | UPN |
user.full_name | userDisplayName | — | Tên hiển thị |
source.ip | ipAddress | initiatedBy.user.ipAddress (chỉ transformation của connector) | IP thực hiện |
source.geo.country_iso_code | location.countryOrRegion | — | Quốc gia |
host.os.family | deviceDetail.operatingSystem | — | OS thiết bị |
user_agent.name | deviceDetail.browser | — | Trình duyệt |
service.name | appDisplayName | — | Ứng dụng đích |
error.code | status.errorCode | — | Mã lỗi Entra ID |
error.message | status.failureReason | resultReason | Mô tả lỗi |
Context bổ sung trong labels (hiển thị/triage, không dùng để viết rule): log_type (transformation connector) / log_source (transformation root), correlation_id, conditional_access_status, is_interactive, client_app_used, resource_name, risk_state, risk_level, device_id, device_is_compliant, device_is_managed, geo_city, geo_state, geo_lat, geo_lon, mfa_detail, initiator_type, initiator_id, initiator_name, target_id, target_upn, target_type, operation_type, logged_by_service, audit_category.
Enrichment tự động (chỉ transformation của connector entraid-log)
Transformation đi kèm connector có thêm block #enrichment — tra cứu entity store bằng user.email rồi bổ sung:
| Field kết quả | Nguồn entity |
|---|---|
user.name | mailNickname |
customs.user_display_name | displayName |
customs.user_department | department |
customs.user_job_title | jobTitle |
customs.user_office_location | officeLocation |
customs.user_type | userType |
customs.user_account_enabled | accountEnabled |
Vì
user.nameđến từ enrichment, nếu chưa cấu hình connectorentraid-entitythì field này sẽ trống trên đường connector. Ở transformation root (shipper ngoài),user.nameđược gán bằng chính UPN.
Detection Rules
Streaming Rules (8 rules — real-time)
| # | Rule | Severity | MITRE ATT&CK | Điều kiện chính |
|---|---|---|---|---|
| 1 | Entra ID Sign-in Failure | Low | TA0006 Credential Access · T1110 Brute Force | event.category = authentication + event.outcome = failure |
| 2 | Entra ID New User Account Created | Low | TA0003 Persistence · T1136.003 Create Account: Cloud Account | event.action = add_user + outcome success |
| 3 | Entra ID Directory Operation Failed | Medium | TA0004 Privilege Escalation · T1098 Account Manipulation | event.category = iam + event.outcome = failure |
| 4 | Entra ID User Account Deleted | High | TA0040 Impact · T1531 Account Access Removal | event.action = delete_user |
| 5 | Entra ID Admin Role Assignment Changed | High | TA0004 Privilege Escalation · T1078 Valid Accounts | event.action chứa role |
| 6 | Entra ID Service Principal or Application Credential Added | High | TA0003 Persistence · T1098.001 Account Manipulation: Additional Cloud Credentials | event.action chứa credential |
| 7 | Entra ID Conditional Access Policy Modified | High | TA0005 Defense Evasion · T1556 Modify Authentication Process | event.action chứa conditional_access |
| 8 | Entra ID Federated Domain or Trust Added | Critical | TA0005 Defense Evasion · T1484.002 Domain or Tenant Policy Modification: Trust Modification | event.action chứa federation hoặc domain_authentication |
Rule 8 là kịch bản Golden SAML / domain federation backdoor — kẻ tấn công thêm federated domain để tự phát hành token hợp lệ. Ưu tiên xử lý cao nhất trong pack.
Correlation Rules (5 rules — pattern)
| # | Rule | Severity | MITRE ATT&CK | Logic | Frequency | Lookback |
|---|---|---|---|---|---|---|
| 9 | Entra ID Brute Force Sign-in | High | TA0006 Credential Access · T1110 Brute Force | ≥ 10 sign-in failure cùng source.ip | 5 phút | 15 phút |
| 10 | Entra ID Password Spray | High | TA0006 Credential Access · T1110.003 Password Spraying | ≥ 10 failure cùng source.ip và trải trên ≥ 10 user.email khác nhau | 5 phút | 15 phút |
| 11 | Entra ID Impossible Travel | High | TA0001 Initial Access · T1078.004 Valid Accounts: Cloud Accounts | ≥ 2 sign-in thành công cùng user.email từ ≥ 2 quốc gia khác nhau | 5 phút | 20 phút |
| 12 | Entra ID Bulk User Deletion | High | TA0040 Impact · T1531 Account Access Removal | ≥ 3 event delete_user thành công | 5 phút | 15 phút |
| 13 | Entra ID Brute Force Followed by Successful Sign-in | High | TA0006 Credential Access · T1110 Brute Force | Custom SQL: ≥ 5 failure rồi có success cùng source.ip + user.email | 5 phút | 20 phút |
Rule 9 và 10 khác nhau ở chiều rộng: rule 9 bắt tấn công dồn vào ít tài khoản, rule 10 bắt tấn công rải mỏng trên nhiều tài khoản để né lockout. Rule 13 là tín hiệu mạnh nhất — có dấu hiệu đã chiếm được tài khoản.
Dashboard — Entra ID Security Overview
| # | Chart | Loại | Mô tả |
|---|---|---|---|
| 1 | Sign-in Events Trend | LINE | Trend sign-in theo thời gian |
| 2 | Total Sign-ins | METRIC | Tổng số sign-in attempt |
| 3 | Sign-in Failures | METRIC | Tổng sign-in thất bại |
| 4 | Unique Active Users | METRIC | Số user sign-in thành công khác nhau |
| 5 | Total IAM Operations | METRIC | Tổng directory audit operation |
| 6 | Sign-in Outcome Distribution | PIE | Success vs Failure |
| 7 | IAM Operation Types | PIE | Phân bố loại directory operation |
| 8 | Top Source IPs with Failed Sign-ins | BAR | IP có nhiều sign-in failure nhất |
| 9 | Top Users with Failed Sign-ins | BAR | User bị sign-in failure nhiều nhất |
| 10 | Top IAM Operations | BAR | Loại directory operation phổ biến nhất |
| 11 | Recent Sign-in Failures | TABLE | Sign-in failure gần nhất |
| 12 | Recent Directory Audit Events | TABLE | Directory audit event gần nhất |
SOC Triage nhanh:
- Metric 3 tăng đột biến → so với Chart 8: một IP chiếm đa số = brute force; rải đều nhiều IP = password spray phân tán
- Alert rule 13 → coi như tài khoản đã bị chiếm: reset credential, thu hồi refresh token, kiểm tra rule 5–7 trong cùng khung giờ
- Alert rule 7 hoặc 8 → xử lý ngay bất kể giờ: kẻ tấn công đang gỡ hàng rào xác thực
- Chart 10 + Table 12 → xác nhận thao tác directory bất thường (tạo app, gán role, xóa user)
- Chart 4 so với Chart 2 → tỷ lệ user thành công thấp bất thường = dấu hiệu chiến dịch credential stuffing đang chạy
Troubleshooting
| Triệu chứng | Nguyên nhân | Cách xử lý |
|---|---|---|
| Test Connection fail | Thiếu admin consent cho Application permission | Vào App registration → API permissions → Grant admin consent |
| Test Connection fail, log 401 | Client secret hết hạn hoặc copy nhầm secret ID | Sinh secret mới, copy đúng cột Value |
| Sign-in log trống, audit log có | Tenant thiếu license Entra ID P1/P2 | Graph auditLogs/signIns yêu cầu P1 trở lên |
| Toàn bộ event bị drop | Field timestamp gốc thiếu hoặc sai format | Phải là 2026-01-15T07:20:01.305Z — đúng 3 chữ số millisecond + Z |
| Field trống hàng loạt | Sai transformation cho đường thu thập | Connector → cần _log_type; shipper ngoài → cần _source (entra_id_signin / entra_id_directoryaudit) |
user.name trống trên đường connector | Chưa cấu hình connector entraid-entity | Thêm log source entraid-entity; user.name do block #enrichment điền từ mailNickname |
user.email trống ở sign-in thất bại | Username không tồn tại trong tenant | Entra ID không trả userPrincipalName khi username sai — hành vi bình thường |
source.ip trống ở directory audit | Transformation root không map initiatedBy.user.ipAddress | Chỉ transformation đi kèm connector lấy field này |
| Rule impossible travel nhiều false positive | User đi qua VPN / cloud proxy egress khác quốc gia | Whitelist dải IP VPN doanh nghiệp hoặc nâng ngưỡng count_unique |
| Lần chạy đầu thiếu dữ liệu cũ | lookback_hours mặc định là 1 | Đặt lookback_hours lớn hơn trước lần chạy đầu |
Checklist sau khi cài:
- App Registration có
AuditLog.Read.All+Directory.Read.All(vàUser.Read.All+Device.Read.Allnếu dùng entity), đã grant admin consent - Log source
entraid-logTest Connection thành công - Log source
entraid-entityđã tạo (nếu cần enrichment user) -
entra-id-parser.yamlđang active trong Transformations - 13 rules hiển thị trong Detection Rules với tag
entra_id - Dashboard Entra ID Security Overview có dữ liệu sau 1–2 chu kỳ poll
Hỗ trợ
- Lỗi platform/Góp ý pack: Dùng tính năng feedback trên trang Marketplace
Last updated: 2026-10-16 · Vendor: Microsoft · Author: secops-team