Modern Authentication เปิดใช้งานโดยค่าเริ่มต้นสำหรับ Tenant Microsoft 365/Azure ใหม่ทั้งหมด โปรโตคอลการรับรองความถูกต้องนี้ปลอดภัยกว่า Basic Authentication แบบดั้งเดิม Microsoft วางแผนบล็อกการใช้ Basic Authentication สำหรับไคลเอนต์ Microsoft 365 ทั้งหมดตั้งแต่วันที่ 1 ตุลาคม 2021 บทความนี้จะดูวิธีเปิด/ปิด Modern และ Basic Authentication ใน Microsoft 365
Modern Authentication vs. Basic Auth
Microsoft รองรับประเภทการรับรองความถูกต้องต่อไปนี้สำหรับ Office 365 (Microsoft 365):
- Basic Authentication — ประเภทการรับรองที่ผู้ใช้ Windows คุ้นเคย ทำงานผ่านหน้าต่าง Windows Security ที่ขอข้อมูลประจำตัว (username/password) และให้บันทึกรหัสผ่านใน Windows Credential Manager ไม่รองรับ MFA (Multifactor Authentication) และไม่ทนทานต่อการโจมตี Brute-force แอปพลิเคชันเก็บและใช้ username/password โดยตรงสำหรับการรับรอง

- Modern Authentication — พัฒนาจาก ADAL (Active Directory Authentication Library) และโปรโตคอล OAuth 2.0 แอปไม่เก็บหรือใช้ข้อมูลประจำตัวผู้ใช้ การรับรองอิงตาม Token ที่มีอายุจำกัด รองรับปัจจัยการรับรองเพิ่มเติมรวมถึง MFA หน้าต่างป้อน username/password ใน Modern Authentication จะปรากฏดังภาพ จะปรากฏเมื่อเชื่อมต่อบริการ Microsoft 365 หรือ Azure (รวมถึงการเชื่อมต่อ PowerShell)

Basic Authentication Sign-in Log ใน Azure AD
ก่อนเปิด Modern Authentication และปิด Basic Authentication ควรตรวจสอบว่าผู้ใช้และแอป Microsoft 365 ใช้โปรโตคอลการรับรองใด
- เปิด Azure Portal
- ไปที่ Azure Active Directory → Sign-in logs
- เลือกช่วงวันที่ Last 1 month
- เพิ่มฟิลเตอร์โดยฟิลด์ Client App
- เลือก Legacy Authentication Clients ทั้งหมดสำหรับฟิลเตอร์นี้
จะช่วยหาผู้ใช้และแอปพลิเคชันที่ยังใช้ Basic Authentication ต้องย้ายแอปที่พบไปใช้โปรโตคอล Modern Auth ในกรณีของผม เหตุการณ์ส่วนใหญ่เกี่ยวข้องกับไคลเอนต์อีเมลเนทีฟบนสมาร์ทโฟน ต้องย้ายไปใช้แอป MS Outlook

Microsoft จะปิด Basic Authentication อัตโนมัติสำหรับ Tenant ที่ไม่ได้ใช้งาน
วิธีเปิด Modern Authentication สำหรับ Microsoft 365 Tenant
สามารถเปิด Modern Authentication ผ่าน Microsoft 365 Admin Center
- เปิดพอร์ทัล M365 Admin https://admin.microsoft.com
- ไปที่ Settings → Org Settings → Modern authentication
- เปิดตัวเลือก Turn on modern authentication for Outlook 2013 for Windows and later
- บันทึกการเปลี่ยนแปลง

เหมือนที่กล่าวมา สำหรับ Tenant Office 365/Azure ใหม่ Basic Authentication ปิดโดยค่าเริ่มต้นสำหรับทุกแอป ในกรณีนี้ จะแสดงคำเตือนในส่วนนี้:
Your organization has security defaults enabled, which means modern authentication to Exchange Online is required, and basic authentication connections are blocked. You must turn off security defaults in the Azure portal before you can change any settings here.

สามารถเปิดรองรับ Basic Auth สำหรับ Tenant จาก Azure Portal (Azure Active Directory → Properties → Manage Security defaults → Enable Security defaults = No)

สังเกตตัวเลือกภายใต้ Allow access to basic authentication protocols นี่คือแอปพลิเคชันต่างๆ ที่สามารถเปิด Basic Authentication ได้:
- Outlook client
- Exchange ActiveSync (EAS)
- Autodiscover
- IMAP4
- POP3
- Authenticated SMTP (ตัวอย่าง SMTP authentication จาก telnet)
- Exchange Online PowerShell — (Basic Authentication ไม่รองรับสำหรับโมดูล EXOv2 PowerShell Module แบบใหม่)
ปิด Basic Authentication สำหรับแอปและโปรโตคอลทั้งหมดที่แน่ใจว่าไม่จำเป็น
หากมีการกำหนดค่านโยบายการรับรองใน Tenant Office 365 สามารถแสดงการตั้งค่าปัจจุบันและโปรโตคอลที่อนุญาตให้ใช้ Basic Authentication ด้วยคำสั่ง PowerShell:
Get-AuthenticationPolicy

ในกรณีของเรา มีนโยบายเพียงหนึ่งเดียว และ BasicAuth ปิดสำหรับทุกแอป
AllowBasicAuthActiveSync : False AllowBasicAuthAutodiscover : False AllowBasicAuthImap : False AllowBasicAuthMapi : False AllowBasicAuthOfflineAddressBook : False AllowBasicAuthOutlookService : False AllowBasicAuthPop : False AllowBasicAuthReportingWebServices : False AllowBasicAuthRest : False AllowBasicAuthRpc : False AllowBasicAuthSmtp : False AllowBasicAuthWebServices : False AllowBasicAuthPowershell : False
เพื่อวัตถุประสงค์ด้านความปลอดภัย สามารถสร้างนโยบายแยกต่างหากพร้อมสิทธิ์ Basic Auth ที่แตกต่างสำหรับโปรโตคอลเฉพาะ และมอบหมายให้ผู้ใช้ที่ใช้แอปพลิเคชันดั้งเดิม ตัวอย่างนี้จะอนุญาตให้ผู้ใช้เชื่อมต่อกับ Exchange Online ผ่าน Remote PowerShell session ด้วย Basic Authentication:
Set-AuthenticationPolicy -Identity "BasicAuth_Allow_PoSh" -AllowBasicAuthPowershell:$true
Set-User -Identity k.muller -AuthenticationPolicy "BasicAuth_Allow_PoSh"
และนโยบายเริ่มต้นจะบล็อกโปรโตคอลการรับรองแบบดั้งเดิม:
New-AuthenticationPolicy -Name "BasicAuth_Block"
Set-OrganizationConfig -DefaultAuthenticationPolicy BasicAuth_Block
ยังมีตัวเลือก OAuth2ClientProfileEnabled ในการตั้งค่าองค์กร ซึ่งกำหนดว่า Modern Auth เปิดสำหรับ Tenant หรือไม่:
Get-OrganizationConfig | ft OAuth*
หาก OAuth2ClientProfileEnabled = False หมายถึง Modern Authentication ปิดอยู่

Modern Authentication ใน Outlook 365/2019/2016/2013/2010
โปรดทราบรายละเอียดการรองรับ Modern Authentication ใน Outlook เวอร์ชันต่างๆ:
- Outlook 2010 และก่อนหน้า — ไม่รองรับ Modern Auth หาก Basic Auth ปิดในการตั้งค่า Tenant เวอร์ชันเหล่านี้จะไม่สามารถเชื่อมต่อกับกล่องจดหมาย Exchange Online บน Microsoft 365 ได้
- Outlook 2013 — เพื่อรองรับ OAuth ต้องตั้งค่าพารามิเตอร์ Registry 2 ตัวภายใต้คีย์ HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\15.0\Common\Identity (
EnableADAL = 1และVersion = 1) - Outlook 365, 2019, 2016 — รองรับ Modern Authentication โดยค่าเริ่มต้น เพื่อให้ใช้ Modern Auth ก่อนเสมอ ให้ตั้งค่า
AlwaysUseMSOAuthForAutoDiscover = 1ภายใต้คีย์ Registry HKEY_CURRENT_USER\Software\Microsoft\Exchange (หากตัวเลือกนี้ไม่เปิด Outlook อาจขอรหัสผ่านซ้ำๆ เพื่อเชื่อมต่อ)
สามารถตรวจสอบว่าไคลเอนต์ Outlook ใช้ Modern Authentication เชื่อมต่อกับกล่องจดหมาย Office 365 ได้ โดย กด Ctrl และคลิกไอคอน Outlook ใน System Tray ตรวจสอบว่าในฟิลด์ Authn ของ Outlook Connection Status ระบุ Bearer* หมายถึง Outlook ใช้ Modern Authentication
