MS-102 GĐ5 – Hybrid Identity Module 35
35

Entra Connect & Cloud Sync – Chuẩn bị

idFix Tool • UPN Suffix • Connect vs Cloud Sync • Prerequisites • Attribute Filtering

Entra Connect Cloud Sync MS-102

01 · Lý thuyết

Entra Connect vs Cloud Sync

Tiêu chíEntra ConnectEntra Cloud Sync
Cài đặtAgent cài trên Windows Server on-premLightweight agent, cấu hình qua portal
Multi-forest phức tạp✓ Full supportHỗ trợ cơ bản
High availabilityStaging server thứ 2Built-in (nhiều agent)
Provisioning on-demand✓ Test sync tức thì
Password writeback
Khuyến nghịMôi trường phức tạp/legacyNew deployments

idFix – Làm sạch AD trước khi sync

Chạy idFix để phát hiện và sửa lỗi AD trước khi cài Entra Connect. Các lỗi phổ biến:

LỗiMô tảCách sửa
Duplicate UPNNhiều user cùng UserPrincipalNameĐổi UPN cho user trùng
Duplicate proxyAddressNhiều object cùng email/aliasXóa alias trùng
Non-routable UPNUPN dạng @domain.localThêm UPN suffix routable
Invalid charactersUPN có ký tự đặc biệtĐổi UPN, bỏ dấu/ký tự lạ

UPN Suffix – Thêm domain routable vào AD

Entra ID yêu cầu UPN phải dùng domain đã verified. Domain .local không verify được — phải thêm suffix routable:

  • AD: thêm UPN suffix viettech.vn tại Active Directory Domains and Trusts
  • Update toàn bộ user: Set-ADUser -UserPrincipalName "[email protected]"
  • Entra: verify domain viettech.vn bằng DNS TXT record
Alternate Login ID: Nếu không muốn đổi UPN trong AD, dùng Alternate Login ID — map mail attribute. User đăng nhập bằng email thay vì UPN.

02 · Thực hành

Lab A: Chạy idFix và sửa lỗi AD

# Tải và chạy idFix Invoke-WebRequest -Uri "https://github.com/microsoft/idfix/releases/latest/download/idfix.zip" -OutFile "C:\idfix\idfix.zip" Expand-Archive "C:\idfix\idfix.zip" -DestinationPath "C:\idfix\" Start-Process "C:\idfix\idfix.exe" # GUI: Click Query → xem ERROR column # Hoặc dùng PowerShell để tìm duplicate UPN $users = Get-ADUser -Filter * -Properties UserPrincipalName $users | Group-Object UserPrincipalName | Where-Object { $_.Count -gt 1 } | Select-Object Name, Count | Format-Table # Tìm UPN dùng .local $users | Where-Object { $_.UserPrincipalName -match "\.local$" } | Select-Object SamAccountName, UserPrincipalName
idFix Results: ERROR TYPE COUNT ----------- ----- DUPLICATE UPN 3 NON-ROUTABLE 45 ← [email protected] phải đổi sang @viettech.vn INVALID CHAR 2 # Fix non-routable UPN hàng loạt: Get-ADUser -Filter { UserPrincipalName -like "*@corp.local" } | ForEach-Object { $newUPN = $_.SamAccountName + "@viettech.vn" Set-ADUser $_ -UserPrincipalName $newUPN Write-Host "Updated: $($_.SamAccountName) -> $newUPN" }

Lab B: Cài Cloud Sync Agent

  1. Vào entra.microsoft.comHybrid managementEntra ConnectCloud sync
  2. Click Download agent → chạy AADConnectProvisioningAgentSetup.exe trên server on-prem
  3. Wizard: Accept license → Authenticate với Global Admin credentials
  4. Active Directory: nhập Domain Admin → chọn forest corp.viettech.local → Add
  5. Click Confirm → Agent cài xong và hiện trong portal sau vài phút
  6. Quay lại portal → New configuration → chọn domain → Enable

Lab C: Provisioning on-demand – Test sync 1 user

# Cloud Sync có tính năng on-demand provisioning rất tiện lợi # Trong portal: entra.microsoft.com → Hybrid → Cloud sync → [config] → Provision on demand # Hoặc dùng Graph API Connect-MgGraph -Scopes "SynchronizationData-User.Upload","Synchronization.ReadWrite.All" # Lấy servicePrincipal ID của Cloud Sync $sp = Get-MgServicePrincipal -Filter "displayName eq 'Active Directory to Azure Active Directory'" # Lấy sync job $job = Get-MgServicePrincipalSynchronizationJob -ServicePrincipalId $sp.Id # Provision on-demand cho user cụ thể $userId = (Get-ADUser -Identity "nguyen.van.a").ObjectGUID.ToString() Invoke-MgServicePrincipalSynchronizationJobProvisionOnDemand -ServicePrincipalId $sp.Id ` -SynchronizationJobId $job.Id ` -BodyParameter @{ parameters = @(@{ subjects = @(@{ objectId = $userId; objectTypeName = "User" }); ruleId = "" }) }
Provisioning on-demand for: nguyen.van.a (GUID: abc123...) Status: Success Steps completed: 1. Import user from Active Directory - Success 2. Determine if user is in scope - In scope 3. Match user between Active Directory and Azure AD - No match (new user) 4. Create user in Azure AD - Success User created: [email protected] (Object ID: def456...)

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

Công ty Cổ phần FPT – Chuẩn bị 10.000 AD accounts cho M365 migration

FPT có 10.000 accounts trong AD DS dùng UPN @fpt.local. Trước khi deploy Entra Connect, idFix phát hiện 247 duplicate proxyAddress và 3.500 UPN dạng .local.

Giải pháp:

  • Script PowerShell hàng loạt đổi 3.500 UPN sang @fpt.com.vn trong 30 phút
  • Xử lý 247 duplicate proxyAddress bằng cách remove alias cũ
  • Chọn Cloud Sync thay vì Entra Connect vì environment đơn giản (1 forest)
  • On-demand provisioning để test 50 pilot users trước khi sync toàn bộ

Kết quả:

  • • 10.000 accounts sync thành công, 0 lỗi sau khi cleanup
  • • Tổng thời gian chuẩn bị: 3 ngày (idFix + fix + pilot test)
  • • Cloud Sync HA: 3 agents đặt ở 3 DC khác nhau