Catalog

Microsoft Entra ID — User Guide

Microsoft Entra ID — User Guide

Pack nameMicrosoft Entra ID
Version1.0.4
VendorMicrosoft
CapabilitiesConnector (×2) · Transformation · Streaming Rules · Correlation Rules · Dashboard
CategoriesIdentity · 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 #enrichment bổ 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ầuChi tiết
Entra ID licenseP1 hoặc P2 — Graph API auditLogs/signIns yêu cầu license này
App RegistrationTạ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ấyDirectory (tenant) ID · Application (client) ID · Client secret value (không phải secret ID)
Quyền platformRole 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/token với scope https://graph.microsoft.com/.default. Không cần Event Hub, Log Analytics hay log shipper ngoài.


Cài đặt

  1. Vào Marketplace → tìm "Microsoft Entra ID" → Install
  2. Vào Data Collection → Data Connectors → Add Connection → chọn connector type entraid-log → điền cấu hình → Test Connection → Save
  3. (Tùy chọn, khuyến nghị) Thêm log source thứ hai với connector type entraid-entity để bật enrichment user/device
  4. Kiểm tra Transformations → entra-id-parser đang active
  5. Kiểm tra Detection Rules → filter tag entra_id → 13 rules đang enabled
  6. Mở Dashboards → Entra ID Security Overview

Cấu hình entraid-log (collection)

FieldKeyKiểuBắt buộcMặc địnhMô tả
Tenant IDtenant_idstring✅—Directory (tenant) ID
Application (Client) IDclient_idstring✅—Client ID của App Registration
Client Secretclient_secretpassword✅—Giá trị client secret
Initial Lookback Hourslookback_hoursint—1Số giờ lấy ngược lại ở lần chạy đầu (chưa có watermark)
Poll Interval (minutes)time_intervalint✅5Chu kỳ gọi Graph API

Cấu hình entraid-entity (enrichment)

FieldKeyKiểuBắt buộcMô tả
Entra Tenant IDtenant_idstring✅Directory (tenant) ID
Client IDclient_idstring✅Client ID của App Registration
Client Secretclient_secretpassword✅Giá trị client secret
Poll Interval (minutes)time_intervalint✅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_secret là chuỗi có nháy, time_interval / lookback_hours là số không nháy.


Cách connector hoạt động

entraid-log — sign-in & directory audit

LuồngEndpoint GraphBộ lọcNhãn gắn vào record
Sign-inGET /v1.0/auditLogs/signIns$filter=createdDateTime ge <since>, $top=1000_log_type = "signin"
Directory auditGET /v1.0/auditLogs/directoryAudits$filter=activityDateTime ge <since>, $orderby=activityDateTime asc, $top=1000_log_type = "directoryaudit"
  • Phân trang theo @odata.nextLink cho 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

EntityEndpoint Graph@entity_type
UserGET /v1.0/usersuser
DeviceGET /v1.0/devicesdevice

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 khiField phân biệt luồngGiá trị
connectors/entraid-log/parser.yamlDùng connector entraid-log (tự động gắn theo connector type)_log_typesignin · directoryaudit
parsers/entra-id-parser.yamlĐẩy log bằng shipper ngoài (Event Hub + Logstash, Log Analytics + Filebeat…)_sourceentra_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 timestamp cuố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 FieldNguồn (sign-in)Nguồn (directory audit)Mô tả
event.modulecố địnhcố địnhLuôn là entra_id
event.datasetentra_id.signinentra_id.directoryauditPhân biệt 2 luồng
event.categoryauthenticationiamĐiều kiện chính của rule
event.actioninteractive_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.outcomeconditionalAccessStatus → success / failure / unknownresult → success / failure / unknownKết quả
event.idididID sự kiện
user.iduserId—Object ID user
user.emailuserPrincipalNametargetResources[0].userPrincipalName, fallback initiatedBy.user.userPrincipalNameUPN
user.full_nameuserDisplayName—Tên hiển thị
source.ipipAddressinitiatedBy.user.ipAddress (chỉ transformation của connector)IP thực hiện
source.geo.country_iso_codelocation.countryOrRegion—Quốc gia
host.os.familydeviceDetail.operatingSystem—OS thiết bị
user_agent.namedeviceDetail.browser—Trình duyệt
service.nameappDisplayName—Ứng dụng đích
error.codestatus.errorCode—Mã lỗi Entra ID
error.messagestatus.failureReasonresultReasonMô 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.namemailNickname
customs.user_display_namedisplayName
customs.user_departmentdepartment
customs.user_job_titlejobTitle
customs.user_office_locationofficeLocation
customs.user_typeuserType
customs.user_account_enabledaccountEnabled

Vì user.name đến từ enrichment, nếu chưa cấu hình connector entraid-entity thì 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)

#RuleSeverityMITRE ATT&CKĐiều kiện chính
1Entra ID Sign-in FailureLowTA0006 Credential Access · T1110 Brute Forceevent.category = authentication + event.outcome = failure
2Entra ID New User Account CreatedLowTA0003 Persistence · T1136.003 Create Account: Cloud Accountevent.action = add_user + outcome success
3Entra ID Directory Operation FailedMediumTA0004 Privilege Escalation · T1098 Account Manipulationevent.category = iam + event.outcome = failure
4Entra ID User Account DeletedHighTA0040 Impact · T1531 Account Access Removalevent.action = delete_user
5Entra ID Admin Role Assignment ChangedHighTA0004 Privilege Escalation · T1078 Valid Accountsevent.action chứa role
6Entra ID Service Principal or Application Credential AddedHighTA0003 Persistence · T1098.001 Account Manipulation: Additional Cloud Credentialsevent.action chứa credential
7Entra ID Conditional Access Policy ModifiedHighTA0005 Defense Evasion · T1556 Modify Authentication Processevent.action chứa conditional_access
8Entra ID Federated Domain or Trust AddedCriticalTA0005 Defense Evasion · T1484.002 Domain or Tenant Policy Modification: Trust Modificationevent.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)

#RuleSeverityMITRE ATT&CKLogicFrequencyLookback
9Entra ID Brute Force Sign-inHighTA0006 Credential Access · T1110 Brute Force≥ 10 sign-in failure cùng source.ip5 phút15 phút
10Entra ID Password SprayHighTA0006 Credential Access · T1110.003 Password Spraying≥ 10 failure cùng source.ip và trải trên ≥ 10 user.email khác nhau5 phút15 phút
11Entra ID Impossible TravelHighTA0001 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 nhau5 phút20 phút
12Entra ID Bulk User DeletionHighTA0040 Impact · T1531 Account Access Removal≥ 3 event delete_user thành công5 phút15 phút
13Entra ID Brute Force Followed by Successful Sign-inHighTA0006 Credential Access · T1110 Brute ForceCustom SQL: ≥ 5 failure rồi có success cùng source.ip + user.email5 phút20 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

#ChartLoạiMô tả
1Sign-in Events TrendLINETrend sign-in theo thời gian
2Total Sign-insMETRICTổng số sign-in attempt
3Sign-in FailuresMETRICTổng sign-in thất bại
4Unique Active UsersMETRICSố user sign-in thành công khác nhau
5Total IAM OperationsMETRICTổng directory audit operation
6Sign-in Outcome DistributionPIESuccess vs Failure
7IAM Operation TypesPIEPhân bố loại directory operation
8Top Source IPs with Failed Sign-insBARIP có nhiều sign-in failure nhất
9Top Users with Failed Sign-insBARUser bị sign-in failure nhiều nhất
10Top IAM OperationsBARLoại directory operation phổ biến nhất
11Recent Sign-in FailuresTABLESign-in failure gần nhất
12Recent Directory Audit EventsTABLEDirectory audit event gần nhất

SOC Triage nhanh:

  1. 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
  2. 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ờ
  3. 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
  4. 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)
  5. 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ứngNguyên nhânCách xử lý
Test Connection failThiếu admin consent cho Application permissionVào App registration → API permissions → Grant admin consent
Test Connection fail, log 401Client secret hết hạn hoặc copy nhầm secret IDSinh secret mới, copy đúng cột Value
Sign-in log trống, audit log cóTenant thiếu license Entra ID P1/P2Graph auditLogs/signIns yêu cầu P1 trở lên
Toàn bộ event bị dropField timestamp gốc thiếu hoặc sai formatPhải là 2026-01-15T07:20:01.305Z — đúng 3 chữ số millisecond + Z
Field trống hàng loạtSai transformation cho đường thu thậpConnector → cần _log_type; shipper ngoài → cần _source (entra_id_signin / entra_id_directoryaudit)
user.name trống trên đường connectorChưa cấu hình connector entraid-entityThêm log source entraid-entity; user.name do block #enrichment điền từ mailNickname
user.email trống ở sign-in thất bạiUsername không tồn tại trong tenantEntra ID không trả userPrincipalName khi username sai — hành vi bình thường
source.ip trống ở directory auditTransformation root không map initiatedBy.user.ipAddressChỉ transformation đi kèm connector lấy field này
Rule impossible travel nhiều false positiveUser đi qua VPN / cloud proxy egress khác quốc giaWhitelist 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.All nếu dùng entity), đã grant admin consent
  • Log source entraid-log Test 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

logo
CMC Telecom
Aspire to Inspire the Digital World