01 · Lý thuyết
Device Inventory – Dữ liệu gì được thu thập?
Khi thiết bị enrolled vào Intune, agent tự động thu thập và báo cáo thông tin phần cứng/phần mềm. Dữ liệu cập nhật theo chu kỳ check-in (Windows: ~8 giờ).
| Danh mục | Thông tin thu thập |
|---|---|
| Hardware | CPU, RAM, storage, serial number, manufacturer, model, BIOS, TPM version |
| OS | OS version, build number, edition, last boot time, join type |
| Network | IP address, MAC address, Wi-Fi SSID, IMEI (mobile) |
| Security | BitLocker status, compliance state, last check-in, enrollment date |
| Applications | Installed apps name + version (từ Add/Remove Programs registry) |
| User | Primary user, last signed-in user, enrollment user UPN |
Intune Built-in Reports
| Report | Nội dung | Vị trí |
|---|---|---|
| Device compliance | Compliant/Non-compliant count, trend | Reports → Device compliance |
| App install status | Success/failure per app per device | Apps → Monitor → Install status |
| Endpoint security | Antivirus, Firewall, BitLocker dashboard | Reports → Endpoint security |
| Windows updates | Update ring compliance per device | Reports → Windows updates |
| Device actions | Wipe, retire, sync history | Devices → Monitor → Device actions |
| Detected apps | Software inventory across all devices | Apps → Monitor → Discovered apps |
Log Analytics & Power BI Integration
- Azure Log Analytics: Stream Intune diagnostic logs real-time, dùng KQL để query nâng cao, lưu trữ >30 ngày
- Intune Data Warehouse (OData): Export toàn bộ inventory sang Power BI, Excel, hoặc bất kỳ BI tool nào
- Power BI Compliance Report: Microsoft cung cấp template Power BI sẵn cho Intune compliance dashboard
Thời gian lưu trữ: Intune portal giữ data 30 ngày. Để audit dài hạn, configure Log Analytics workspace để archive indefinitely.
02 · Thực hành
Lab A: Export Device Inventory ra CSV
Connect-MgGraph -Scopes "DeviceManagementManagedDevices.Read.All"
$devices = Invoke-MgGraphRequest -Method GET `
-Uri "https://graph.microsoft.com/v1.0/deviceManagement/managedDevices?`$select=deviceName,serialNumber,manufacturer,model,osVersion,physicalMemoryInBytes,totalStorageSpaceInBytes,complianceState,userDisplayName,lastSyncDateTime"
$devices.value | Select-Object `
deviceName, serialNumber, manufacturer, model, osVersion,
@{N='RAM_GB';E={[math]::Round($_.physicalMemoryInBytes/1GB,1)}},
@{N='Storage_GB';E={[math]::Round($_.totalStorageSpaceInBytes/1GB,0)}},
complianceState, userDisplayName, lastSyncDateTime |
Export-Csv "C:\Reports\Device-Inventory-$(Get-Date -f 'yyyyMMdd').csv" -NoTypeInformation -Encoding UTF8
Write-Host "Exported $($devices.value.Count) devices"
Exported 342 devices
deviceName manufacturer model RAM_GB Storage_GB complianceState
----------- ------------ -------------------- ------ ---------- ---------------
LAPTOP-VT001 Dell Latitude 5520 16.0 512 compliant
LAPTOP-KT002 Lenovo ThinkPad X1 Carbon 16.0 256 noncompliant
PHONE-LD003 Apple iPhone 14 Pro 6.0 128 compliant
Lab B: Phát hiện phần mềm không được phép
# Tìm thiết bị đang chạy phần mềm không được phép
$blockedApps = @("TeamViewer", "AnyDesk", "uTorrent")
foreach ($appName in $blockedApps) {
$found = Invoke-MgGraphRequest -Method GET `
-Uri "https://graph.microsoft.com/v1.0/deviceManagement/detectedApps?`$filter=displayName eq '$appName'"
if ($found.value.Count -gt 0) {
Write-Host "ALERT: $appName detected on $($found.value[0].deviceCount) devices" -ForegroundColor Red
# Lấy danh sách device cụ thể
$devList = Invoke-MgGraphRequest -Method GET `
-Uri "https://graph.microsoft.com/v1.0/deviceManagement/detectedApps/$($found.value[0].id)/managedDevices"
$devList.value | Select-Object deviceName, userDisplayName | Format-Table
}
}
ALERT: TeamViewer detected on 3 devices
ALERT: AnyDesk detected on 1 devices
deviceName userDisplayName
----------- ---------------
LAPTOP-VT018 Nguyen Van X
LAPTOP-KT025 Tran Thi Y
LAPTOP-LD031 Le Van Z
# Hành động tiếp theo: tạo Compliance Policy block TeamViewer
# hoặc tạo Win32 Uninstall deployment để remove khỏi tất cả thiết bị
Lab C: Cấu hình Log Analytics cho Intune
Thực hành tại: intune.microsoft.com → Tenant administration → Diagnostic settings
- Vào Tenant administration → Diagnostic settings → Add diagnostic setting
- Name:
Intune-to-LogAnalytics - Chọn log categories:
• AuditLogs ✓ (ai làm gì trên Intune portal)
• OperationalLogs ✓ (device operations: enroll, compliance change)
• DeviceComplianceOrg ✓ (compliance state thay đổi)
• Devices ✓ (hardware inventory changes) - Destination: Send to Log Analytics workspace → chọn workspace đã tạo
- Nhấn Save — data sẽ bắt đầu stream trong ~15 phút
Lab D: KQL Query trong Log Analytics
// Query: Thiết bị non-compliant trong 7 ngày qua
DeviceComplianceOrg
| where TimeGenerated > ago(7d)
| where ComplianceState == "noncompliant"
| summarize count() by DeviceName, UserName, OS, bin(TimeGenerated, 1d)
| order by TimeGenerated desc
// Query: Audit log – ai đã xóa device trong 30 ngày
IntuneAuditLogs
| where TimeGenerated > ago(30d)
| where OperationName == "Delete ManagedDevice"
| project TimeGenerated, InitiatedByUser=tostring(Actor.userPrincipalName),
DeviceName=tostring(Targets[0].displayName), Result
| order by TimeGenerated desc
// Query: App install failures
IntuneOperationalLogs
| where TimeGenerated > ago(7d)
| where OperationName == "Application"
| where Result == "Fail"
| project TimeGenerated, DeviceName, AppName=tostring(parse_json(Properties).ApplicationName),
ErrorCode=tostring(parse_json(Properties).ErrorCode)
| summarize FailCount=count() by AppName, ErrorCode
| order by FailCount desc
// Kết quả non-compliant devices:
DeviceName UserName OS TimeGenerated count_
----------- ---------- ------- -------------------- ------
LAPTOP-KT002 tran.thi.y Windows 2024-03-15 00:00:00 3
PHONE-LD015 le.van.z iOS 2024-03-14 00:00:00 1
// App install failures:
AppName ErrorCode FailCount
--------------- ---------- ---------
7-Zip 23.01 0x80070002 8
Adobe Reader DC 0x80070005 3
03 · Tình huống thực tế
FPT Software – Kiểm toán IT cho khách hàng nước ngoài (ISO 27001)
FPT Software cần chứng minh với khách hàng Nhật Bản rằng tất cả 1.500 laptop của developer đều được quản lý, mã hóa, và tuân thủ chính sách bảo mật — để pass ISO 27001 audit hàng năm.
Giải pháp Intune Reporting:
- ✓ Device Inventory export: Monthly CSV report — 100% thiết bị có serial number, BitLocker status, OS version
- ✓ Log Analytics: Lưu trữ 2 năm audit log — ai access Intune, thiết bị nào thay đổi compliance
- ✓ Power BI dashboard: Real-time compliance rate, non-compliant devices, phần mềm phát hiện
- ✓ Detected apps scan: Tuần 1 lần, alert nếu TeamViewer/AnyDesk xuất hiện (remote access tool không được phép)
- ✓ Monthly report: Tự động generate bằng PowerShell, gửi email cho CISO và ISO 27001 committee
Kết quả:
- • Pass ISO 27001 audit lần đầu tiên với zero finding về device management
- • Phát hiện 12 thiết bị cài TeamViewer trái phép, đã remove trong 24 giờ
- • Compliance rate duy trì 99.2% — báo cáo tự động, không cần IT manual check