MD-102 Giai đoạn 2 – Quản lý ứng dụng Module 09
09

App Deployment với Intune

Win32 Apps • LOB Apps • Microsoft Store • IntuneWinAppUtil • Required vs Available

Microsoft Intune Win32 Apps MD-102 GĐ2

01 · Lý thuyết

Các loại ứng dụng trong Intune

Loại ứng dụngFormatUse caseƯu điểmHạn chế
Win32 app.intunewinPhần mềm doanh nghiệp phức tạpHỗ trợ detection rules, dependencies, supersedenceCần đóng gói bằng IntuneWinAppUtil
Line-of-business (LOB).msi, .appx, .ipa, .apkApp nội bộ doanh nghiệpUpload trực tiếp, đơn giảnÍt tùy chọn cấu hình hơn Win32
Microsoft Store (new)WinGet packageApp từ Microsoft StoreAuto-update, không cần uploadChỉ app có trên Store
Web linkURLWeb app / SaaSKhông cần file, nhanhChỉ là shortcut, không install
Microsoft 365 AppsODTWord, Excel, Teams, OneDriveTích hợp sâu, update tự độngChỉ dành cho M365 apps
Managed Google PlayAndroid APKApp cho Android EnterpriseQuản lý qua Play StoreCần Android Enterprise setup

Win32 App – Chi tiết quy trình

Win32 là loại app phổ biến và mạnh nhất trong Intune. Quy trình gồm 3 bước chính:

1

Đóng gói

Dùng IntuneWinAppUtil.exe để nén installer thành file .intunewin

2

Upload & Cấu hình

Upload .intunewin lên Intune, cấu hình install/uninstall command, detection rules

3

Assign & Monitor

Assign cho group với intent Required/Available, theo dõi installation status

Assignment Intent – Required vs Available vs Uninstall

IntentHành viUser có thể từ chối?Use case
RequiredTự động cài đặt, không hỏi userKhôngSecurity agents, mandatory tools
AvailableHiện trong Company Portal, user tự càiCó (user chọn)Optional apps, productivity tools
Available without enrollmentAvailable cho MAM-WE devicesBYOD, web apps
UninstallGỡ cài đặt tự độngKhôngRemove legacy apps, cleanup

Detection Rules – Xác định app đã cài hay chưa

Loại ruleCách hoạt độngVí dụ
MSI product codeKiểm tra GUID trong registry{7D5F1B3A-...}
File/FolderKiểm tra file/folder tồn tại, version, sizeC:\Program Files\App\app.exe version ≥ 3.0
RegistryKiểm tra registry key/valueHKLM\Software\App\Installed = 1
Custom scriptPowerShell script trả về exit codeScript kiểm tra service running

Dependencies và Supersedence

  • Dependencies: App A yêu cầu App B phải cài trước. Intune tự động cài App B trước khi cài App A. Ví dụ: .NET Runtime là dependency của nhiều ứng dụng doanh nghiệp.
  • Supersedence: App mới thay thế App cũ. Intune tự gỡ phiên bản cũ và cài phiên bản mới. Ví dụ: Adobe Reader 2024 supersede Adobe Reader 2023.
Giới hạn file .intunewin: Tối đa 8 GB sau khi nén. Intune dùng Azure CDN để phân phối, hỗ trợ bandwidth throttling để không ảnh hưởng mạng công ty trong giờ làm việc.

02 · Thực hành

Lab A: Đóng gói Win32 App bằng IntuneWinAppUtil

# Tải IntuneWinAppUtil từ GitHub Invoke-WebRequest -Uri "https://github.com/microsoft/Microsoft-Win32-Content-Prep-Tool/raw/master/IntuneWinAppUtil.exe" ` -OutFile "C:\IntunePrep\IntuneWinAppUtil.exe" # Chuẩn bị thư mục New-Item -ItemType Directory -Path "C:\IntunePrep\Source" -Force New-Item -ItemType Directory -Path "C:\IntunePrep\Output" -Force # Copy installer vào Source (ví dụ: 7-Zip) Copy-Item "C:\Downloads\7z2301-x64.exe" "C:\IntunePrep\Source\" # Đóng gói thành .intunewin C:\IntunePrep\IntuneWinAppUtil.exe ` -c "C:\IntunePrep\Source" ` # Thư mục chứa installer -s "7z2301-x64.exe" ` # File installer chính -o "C:\IntunePrep\Output" ` # Thư mục output -q # Quiet mode
Microsoft Win32 Content Prep Tool Version: 1.8.4.0 Copyright (c) Microsoft Corporation. All rights reserved. INFO Creating intunewin file for source folder: C:\IntunePrep\Source INFO Scanning source folder: C:\IntunePrep\Source INFO Creating content file: C:\IntunePrep\Output\7z2301-x64.intunewin INFO Compressing the package... INFO Done. INFO Created package: 7z2301-x64.intunewin (Size: 1.82 MB)

Lab B: Upload Win32 App lên Intune Portal

Thực hành tại: intune.microsoft.com → Apps → Windows → Add

  1. Vào intune.microsoft.comAppsWindowsAdd
  2. App type: chọn Windows app (Win32) → Select
  3. Tab App information:
    • Select app package file: upload 7z2301-x64.intunewin
    • Name: 7-Zip 23.01
    • Description: Free open-source file archiver
    • Publisher: Igor Pavlov
    • Install behavior: System (cài cho toàn máy)
  4. Tab Program:
    • Install command: 7z2301-x64.exe /S
    • Uninstall command: MsiExec.exe /X{23170F69-40C1-2702-2301-000001000000} /qn
    • Return codes: 0 = Success, 3010 = Reboot required
  5. Tab Requirements:
    • OS Architecture: x64
    • Minimum OS: Windows 10 21H2
  6. Tab Detection rules:
    • Rule type: File
    • Path: C:\Program Files\7-Zip
    • File: 7z.exe
    • Detection method: File or folder exists
  7. Tab Assignments:
    • Required: All Devices (bắt buộc cài)
    • Available: GRP-IT-Admins (tùy chọn qua Company Portal)
  8. Review + Create → Create

Lab C: Deploy Win32 App qua Graph PowerShell

Connect-MgGraph -Scopes "DeviceManagementApps.ReadWrite.All" # Kiểm tra danh sách Win32 apps đã deploy $apps = Invoke-MgGraphRequest -Method GET ` -Uri "https://graph.microsoft.com/v1.0/deviceAppManagement/mobileApps?`$filter=isof('microsoft.graph.win32LobApp')" $apps.value | Select-Object displayName, publishingState, createdDateTime | Format-Table -AutoSize # Xem install status của một app $appId = ($apps.value | Where-Object displayName -eq "7-Zip 23.01").id $installSummary = Invoke-MgGraphRequest -Method GET ` -Uri "https://graph.microsoft.com/v1.0/deviceAppManagement/mobileApps/$appId/installSummary" Write-Host "Installed: $($installSummary.installedDeviceCount)" Write-Host "Failed: $($installSummary.failedDeviceCount)" Write-Host "Pending: $($installSummary.pendingInstallDeviceCount)"
displayName publishingState createdDateTime ------------------ --------------- ---------------------- 7-Zip 23.01 published 2024-03-15T09:00:00Z Adobe Reader DC published 2024-02-01T08:00:00Z VPN Client 5.0 published 2024-01-10T10:00:00Z Installed: 142 Failed: 3 Pending: 15

Lab D: Thêm Dependency (.NET Runtime)

# Lấy ID của app dependency (.NET 6 Runtime) $dotnetApp = Invoke-MgGraphRequest -Method GET ` -Uri "https://graph.microsoft.com/v1.0/deviceAppManagement/mobileApps?`$filter=displayName eq '.NET 6 Runtime'" $dotnetId = $dotnetApp.value[0].id # Lấy ID của app chính (app cần dependency) $mainApp = Invoke-MgGraphRequest -Method GET ` -Uri "https://graph.microsoft.com/v1.0/deviceAppManagement/mobileApps?`$filter=displayName eq 'Company ERP 3.0'" $mainAppId = $mainApp.value[0].id # Thêm dependency relationship $body = @{ "@odata.type" = "#microsoft.graph.mobileAppRelationship" targetId = $dotnetId targetType = "parent" # .NET Runtime là parent (phải cài trước) } | ConvertTo-Json Invoke-MgGraphRequest -Method POST ` -Uri "https://graph.microsoft.com/v1.0/deviceAppManagement/mobileApps/$mainAppId/relationships" ` -Body $body -ContentType "application/json"
@odata.type : #microsoft.graph.mobileAppRelationship id : rel-abc123-def456 targetId : dotnet6-app-id targetType : parent sourceId : erp-app-id # Kết quả: khi deploy Company ERP 3.0, Intune sẽ tự động cài .NET 6 Runtime trước

Lab E: Xử lý lỗi cài đặt phổ biến

# Kiểm tra log cài đặt trên máy client # Log path: C:\ProgramData\Microsoft\IntuneManagementExtension\Logs\ # Xem IntuneManagementExtension.log (log chính) Get-Content "C:\ProgramData\Microsoft\IntuneManagementExtension\Logs\IntuneManagementExtension.log" ` -Tail 50 | Where-Object { $_ -match "Error|Failed|Exception|7-Zip" } # Kiểm tra App Install log Get-Content "C:\ProgramData\Microsoft\IntuneManagementExtension\Logs\AgentExecutor.log" ` -Tail 30
[Error] App installation failed. Error code: 0x80070002 [Info] App: 7-Zip 23.01, Intent: Required, Result: Failed # Error code phổ biến: # 0x80070002 = File not found (kiểm tra lại install command) # 0x80070005 = Access denied (kiểm tra install behavior: System vs User) # 0x87D30068 = Network error (kiểm tra kết nối internet/proxy) # 3010 = Success, reboot required (cần khởi động lại)

03 · Tình huống thực tế

Công ty CP Phần mềm VietTech – Chuẩn hoá 300 máy tính

VietTech vừa mua thêm 300 laptop mới cho đội kỹ thuật. Mỗi máy cần có sẵn: Visual Studio Code, Git for Windows, Python 3.12, DBeaver, VPN Client, và .NET 8 Runtime. Trước đây IT phải cài tay từng máy mất 3–4 ngày.

Giải pháp Intune Win32 Deployment:

  • Đóng gói tất cả 6 ứng dụng thành .intunewin bằng IntuneWinAppUtil
  • Cấu hình .NET 8 Runtime là dependency của Visual Studio Code
  • Set intent = Required cho tất cả → tự động cài ngay khi máy enroll vào Intune
  • Assign cho group GRP-Dev-New-Machines
  • Máy mới chỉ cần: bật nguồn → đăng nhập M365 account → 30–45 phút tự cài hết

Kết quả:

  • • Giảm từ 3–4 ngày xuống còn 0 giờ IT can thiệp cho mỗi máy
  • • 100% máy đồng nhất cấu hình — không còn "máy tôi không có X"
  • • Dễ dàng update: khi Python 3.13 ra, chỉ cần upload version mới và set Supersedence