在本地 Exchange 中配置混合现代身份验证
如何在本地 Exchange Server 中启用混合现代身份验证 (HMA)?我们希望使用现代身份验证而不是基本身份验证来保护 Exchange 本地组织。这样,我们就可以将 MFA 用于本地用户邮箱,而不仅仅是云中的用户邮箱。在本文中,您将了解如何在本地 Exchange 中逐步配置混合现代身份验证。
介绍
我们有 Exchange 混合部署。大多数邮箱位于 Exchange Online 中,但我们也有本地邮箱。这是因为公司政策。现在我们在本地拥有邮箱,我们希望用户使用现代身份验证而不是默认的基本身份验证进行身份验证。
笔记:混合现代身份验证非常适合单个 Exchange Server 或高可用性(负载平衡)的 Exchange Server。
混合现代身份验证先决条件
在开始配置混合现代身份验证之前,请确保您已完成以下步骤:
- Exchange 混合配置向导*
- 安装和配置 Microsoft Entra Connect
- Exchange Server 2010 未在组织中运行
- 安装了最新累积更新的 Exchange Server 2013/2016/2019
*混合代理不支持混合现代身份验证。您将需要利用经典 Exchange 混合拓扑并发布 AutoDiscover、EWS、ActiveSync、MAPI 和 OAB 端点以进行混合现代身份验证,以便与各种 Outlook 客户端配合使用。
笔记:Exchange OWA(Outlook Web Access)和ECP(Exchange 控制面板)与现代身份验证配合使用。但是,您需要安装带有 2024 年 4 月 Exchange Server 修补程序更新或更高版本的 Exchange Server 2019 CU14。
我们建议您在 Exchange Server 本地组织中启用新式身份验证,以保护 Outlook 客户端、Exchange OWA 和 Exchange ECP。这意味着您需要安装 Exchange Server 2019 并且使用最新版本。
混合现代身份验证图
在下图中,您可以看到混合现代身份验证流程实施后的样子。
- 拥有本地邮箱的用户启动 Outlook 并通过自动发现连接到 Exchange Server。连接将重定向到您设置的 evoSTS URL。
- Outlook 客户端联系 Microsoft Entra ID,并显示新式身份验证登录提示。用户将使用为 Exchange Online 应用程序(云应用程序)设置的相同条件访问策略进行身份验证。
- 身份验证成功后,用户将获得访问令牌和刷新令牌。
- 用户向本地 Exchange Server 提供访问令牌并获得对邮箱的访问权限。
现代身份验证的优点
在本地 Exchange Server 中配置新式身份验证的优点是:
- 比基本身份验证(经典用户名和密码)更安全
- 从 Microsoft Entra ID(中央位置)配置策略
- 现代外观和感觉,带来最终用户体验
如何配置混合现代身份验证
Amanda 在本地有一个邮箱,我们可以通过以下步骤验证她是否通过 Outlook 桌面应用程序中的基本身份验证进行连接:
- 启动 Outlook
- 按住CTRL 键和右键单击在 Windows 系统托盘中的 Outlook 客户端上
- 点击连接状态
在Authn(身份验证)栏中,您将看到比*作为认证方案。这意味着您使用基本身份验证。
这验证码列需要显示为持票人*。那时你就知道了现代认证被使用。
在为 Exchange 本地组织启用混合现代身份验证之前,我们将完成以下步骤并确保一切就绪。
每次运行 cmdlet 时请仔细查看。这是因为您需要在以下位置执行管理任务:
- Exchange 命令行管理程序(本地 Exchange 服务器)
- PowerShell(Microsoft Graph PowerShell)
步骤 1. 在 Exchange Online 中启用新式身份验证
请阅读文章在 Microsoft 365 中启用新式身份验证来了解更多信息。
要在 Exchange Online 中启用新式身份验证,请按照下列步骤操作:
- 登录到Microsoft 365 管理中心
- 扩张设置并点击组织设置
- 点击服务在顶部栏中
- 选择现代认证从列表中
- 勾选复选框为 Outlook 2013 for Windows 及更高版本启用新式身份验证(推荐)
- 点击节省
笔记:对于 2017 年 8 月 1 日之前创建的租户,默认情况下会关闭 Exchange Online 和 Skype for Business Online 的新式身份验证。
步骤 2. 获取虚拟目录 URL
在本地 Exchange Server 上以管理员身份启动 Exchange 命令行管理程序。运行四个 cmdlet检索虚拟目录 URL。
Get-MapiVirtualDirectory | fl server,*url*
Get-WebServicesVirtualDirectory | fl server,*url*
Get-ClientAccessServer | fl Name, AutodiscoverServiceInternalUri
Get-OABVirtualDirectory | fl server,*url*
运行每个命令后,结果将显示在下面的输出中。记下所有内部和外部 URL,因为您需要在后续步骤之一中添加这些 URL。
在我们的示例中,内部和外部 URL 具有相同的名称。我们建议像这样配置它,因为它会简化很多。如果没有,您会在输出中看到以 .local 或 .lan 结尾的内部地址。
# Get-MapiVirtualDirectory | fl server,*url*
Server : EX01-2019
InternalUrl : https://mail.exoip.com/mapi
ExternalUrl : https://mail.exoip.com/mapi
Server : EX02-2019
InternalUrl : https://mail.exoip.com/mapi
ExternalUrl : https://mail.exoip.com/mapi
# Get-WebServicesVirtualDirectory | fl server,*url*
Server : EX01-2019
InternalNLBBypassUrl :
InternalUrl : https://mail.exoip.com/EWS/Exchange.asmx
ExternalUrl : https://mail.exoip.com/EWS/Exchange.asmx
Server : EX02-2019
InternalNLBBypassUrl :
InternalUrl : https://mail.exoip.com/EWS/Exchange.asmx
ExternalUrl : https://mail.exoip.com/EWS/Exchange.asmx
# Get-ClientAccessServer | fl Name, AutodiscoverServiceInternalUri
WARNING: The Get-ClientAccessServer cmdlet will be removed in a future version of Exchange. Use the
Get-ClientAccessService cmdlet instead. If you have any scripts that use the Get-ClientAccessServer cmdlet, update them
to use the Get-ClientAccessService cmdlet. For more information, see https://go.microsoft.com/fwlink/p/?LinkId=254711.
Name : EX01-2019
AutoDiscoverServiceInternalUri : https://autodiscover.exoip.com/Autodiscover/Autodiscover.xml
Name : EX02-2019
AutoDiscoverServiceInternalUri : https://autodiscover.exoip.com/Autodiscover/Autodiscover.xml
# Get-OABVirtualDirectory | fl server,*url*
Server : EX01-2019
InternalUrl : https://mail.exoip.com/OAB
ExternalUrl : https://mail.exoip.com/OAB
Server : EX02-2019
InternalUrl : https://mail.exoip.com/OAB
ExternalUrl : https://mail.exoip.com/OAB
以管理员身份运行 PowerShell 并连接到 Microsoft Graph PowerShell。使用您的 Microsoft 365 全局管理员凭据登录。
Connect-MgGraph -Scopes "Application.Read.All", "Application.ReadWrite.All"
运行获取 MgServicePrincipal用于获取应用程序 00000002-0000-0ff1-ce00-000000000000 的云中与 Exchange 相关的 URL 的 cmdlet。
Get-MgServicePrincipal -Filter "AppId eq '00000002-0000-0ff1-ce00-000000000000'" | select -ExpandProperty ServicePrincipalNames
记下(以及用于稍后比较的屏幕截图)此命令的输出,其中应包括 https://autodiscover.yourdomain.com 和 https://mail.yourdomain.com URL,但主要由以 00000002-0000-0ff1-ce00-000000000000/ 开头的 SPN 组成。
00000002-0000-0ff1-ce00-000000000000/mail.exoip.com
00000002-0000-0ff1-ce00-000000000000/autodiscover.exoip365.mail.onmicrosoft.com
00000002-0000-0ff1-ce00-000000000000/exoip365.mail.onmicrosoft.com
00000002-0000-0ff1-ce00-000000000000/autodiscover.exoip.com
00000002-0000-0ff1-ce00-000000000000/exoip.com
00000002-0000-0ff1-ce00-000000000000/autodiscover.exoip.local
00000002-0000-0ff1-ce00-000000000000/exoip.local
00000002-0000-0ff1-ce00-000000000000/outlook.office365.com
00000002-0000-0ff1-ce00-000000000000/mail.office365.com
00000002-0000-0ff1-ce00-000000000000/outlook.com
00000002-0000-0ff1-ce00-000000000000/*.outlook.com
00000002-0000-0ff1-ce00-000000000000
https://ps.compliance.protection.outlook.com
https://outlook-sdf.office.com/
https://outlook-sdf.office365.com/
https://outlook.office365.com:443/
https://outlook.office.com/
https://outlook.office365.com/
https://outlook.com/
https://ps.protection.outlook.com/
https://outlook-tdf.office.com/
https://outlook-tdf-2.office.com/
https://ps.outlook.com
最有可能的是,https:// 网址来自您本地的数据(步骤 2)丢失。因此,我们需要在下一步中将这些特定记录添加到此列表中。
步骤 4. 将本地 Web 服务 URL 添加为 SPN
如果在此列表中没有看到内部和外部 MAPI/HTTP、EWS、ActiveSync、OAB 和自动发现记录,则必须在 Microsoft Graph PowerShell 中使用以下命令添加它们。
在此示例中,URL 为 https://mail.exoip.com/ 和 https://autodiscover.exoip.com/。将 URL 替换为您自己的 URL。
$x = Get-MgServicePrincipal -Filter "AppId eq '00000002-0000-0ff1-ce00-000000000000'"
$x.ServicePrincipalNames += "https://mail.exoip.com/"
$x.ServicePrincipalNames += "https://autodiscover.exoip.com/"
Update-MgServicePrincipal -ServicePrincipalId $x.Id -ServicePrincipalNames $x.ServicePrincipalNames
假设您想恢复更改。更改下面的 URL 并运行命令。
$x = Get-MgServicePrincipal -Filter "AppId eq '00000002-0000-0ff1-ce00-000000000000'"
$x.ServicePrincipalNames = $x.ServicePrincipalNames | Where-Object { $_ -ne "https://mail.exoip.com/" -and $_ -ne "https://autodiscover.exoip.com/" }
Update-MgServicePrincipal -ServicePrincipalId $x.Id -ServicePrincipalNames $x.ServicePrincipalNames
通过运行以下命令验证您是否添加了新记录获取 MgServicePrincipalMicrosoft Graph PowerShell 中的 cmdlet。
Get-MgServicePrincipal -Filter "AppId eq '00000002-0000-0ff1-ce00-000000000000'" | select -ExpandProperty ServicePrincipalNames
查看输出。将之前的列表/屏幕截图与新的 SPN 列表进行比较。您还可以截取新列表的屏幕截图以供记录。如果成功,您将在列表中看到两个新 URL。
按照我们的示例,SPN 列表现在包括特定 URL https://mail.exoip.com/ 和 https://autodiscover.exoip.com/。在列表顶部查看它。
https://autodiscover.exoip.com/
https://mail.exoip.com/
00000002-0000-0ff1-ce00-000000000000/mail.exoip.com
00000002-0000-0ff1-ce00-000000000000/autodiscover.exoip365.mail.onmicrosoft.com
00000002-0000-0ff1-ce00-000000000000/exoip365.mail.onmicrosoft.com
00000002-0000-0ff1-ce00-000000000000/autodiscover.exoip.com
00000002-0000-0ff1-ce00-000000000000/exoip.com
00000002-0000-0ff1-ce00-000000000000/autodiscover.exoip.local
00000002-0000-0ff1-ce00-000000000000/exoip.local
00000002-0000-0ff1-ce00-000000000000/outlook.office365.com
00000002-0000-0ff1-ce00-000000000000/mail.office365.com
00000002-0000-0ff1-ce00-000000000000/outlook.com
00000002-0000-0ff1-ce00-000000000000/*.outlook.com
00000002-0000-0ff1-ce00-000000000000
https://ps.compliance.protection.outlook.com
https://outlook-sdf.office.com/
https://outlook-sdf.office365.com/
https://outlook.office365.com:443/
https://outlook.office.com/
https://outlook.office365.com/
https://outlook.com/
https://ps.protection.outlook.com/
https://outlook-tdf.office.com/
https://outlook-tdf-2.office.com/
https://ps.outlook.com
步骤 6. 验证 OAuth 虚拟目录
现在验证 OAuth(新式身份验证)是否已在 Outlook 可能使用的所有虚拟目录上的本地 Exchange 中正确启用。在 Exchange 命令行管理程序中运行 cmdlet。
Get-MapiVirtualDirectory | fl server,*url*,*auth*
Get-WebServicesVirtualDirectory | fl server,*url*,*oauth*
Get-OABVirtualDirectory | fl server,*url*,*oauth*
Get-AutoDiscoverVirtualDirectory | fl server,*oauth*
运行每个命令后,结果将显示在下面的输出中。
# Get-MapiVirtualDirectory | fl server,*url*,*auth*
Server : EX01-2019
InternalUrl : https://mail.exoip.com/mapi
ExternalUrl : https://mail.exoip.com/mapi
IISAuthenticationMethods : {Ntlm, OAuth, Negotiate}
InternalAuthenticationMethods : {Ntlm, OAuth, Negotiate}
ExternalAuthenticationMethods : {Ntlm, OAuth, Negotiate}
Server : EX02-2019
InternalUrl : https://mail.exoip.com/mapi
ExternalUrl : https://mail.exoip.com/mapi
IISAuthenticationMethods : {Ntlm, OAuth, Negotiate}
InternalAuthenticationMethods : {Ntlm, OAuth, Negotiate}
ExternalAuthenticationMethods : {Ntlm, OAuth, Negotiate}
# Get-WebServicesVirtualDirectory | fl server,*url*,*oauth*
Server : EX01-2019
InternalNLBBypassUrl :
InternalUrl : https://mail.exoip.com/EWS/Exchange.asmx
ExternalUrl : https://mail.exoip.com/EWS/Exchange.asmx
OAuthAuthentication : True
Server : EX02-2019
InternalNLBBypassUrl :
InternalUrl : https://mail.exoip.com/EWS/Exchange.asmx
ExternalUrl : https://mail.exoip.com/EWS/Exchange.asmx
OAuthAuthentication : True
# Get-OABVirtualDirectory | fl server,*url*,*oauth*
Server : EX01-2019
InternalUrl : https://mail.exoip.com/OAB
ExternalUrl : https://mail.exoip.com/OAB
OAuthAuthentication : True
Server : EX02-2019
InternalUrl : https://mail.exoip.com/OAB
ExternalUrl : https://mail.exoip.com/OAB
OAuthAuthentication : True
# Get-AutoDiscoverVirtualDirectory | fl server,*oauth*
Server : EX01-2019
OAuthAuthentication : True
Server : EX02-2019
OAuthAuthentication : True
如果任何服务器和四个虚拟目录中的任何一个缺少 OAuth,您需要在继续之前使用相关命令添加它:
步骤 7. 确认 EvoSTS 身份验证服务器对象存在
返回本地 Exchange 命令行管理程序。运行 cmdlet 并验证您的本地是否具有 evoSTS(Microsoft Entra ID 使用的安全令牌服务)身份验证提供程序的条目。
Get-AuthServer | Where-Object {$_.Name -like "EvoSts*"} | fl Name,DomainName,IssuerIdentifier,Realm,TokenIssuingEndpoint,Enabled,IsDefault*
您的输出应该显示一个 AuthServer,其中包含姓名开始于埃沃斯特,以及启用状态值应该是真的。如果您没有看到此内容,则应下载并运行最新版本的混合配置向导。
在我们的输出中,我们有两个 evoSts 身份验证服务器。这是因为我们的本地部署配置了两个租户。
Name : EvoSts - 5af53ad5-4ce1-4406-bf3f-b8c796cf17b8
DomainName : {exoip365.onmicrosoft.com}
IssuerIdentifier : https://sts.windows.net/fe15bfe6-36b2-4c9d-bf42-51b995f8e9af/
Realm : fe15bfe6-36b2-4c9d-bf42-51b995f8e9af
TokenIssuingEndpoint : https://login.windows.net/common/oauth2/token
Enabled : True
IsDefaultAuthorizationEndpoint : False
Name : EvoSts - d1c9beac-0655-48e7-9949-5e497af1d38d
DomainName : {exoip.com}
IssuerIdentifier : https://sts.windows.net/d032a20d-16c9-4e5b-87c3-30b055ded8cc/
Realm : d032a20d-16c9-4e5b-87c3-30b055ded8cc
TokenIssuingEndpoint : https://login.windows.net/common/oauth2/token
Enabled : True
IsDefaultAuthorizationEndpoint : False
步骤 8.启用混合现代身份验证
如果您有多个 evoSts 身份验证服务器,您需要知道要将哪一台设置为默认服务器。在 Microsoft Graph PowerShell 中,运行 cmdlet 以检索组织 ID。
Get-MgOrganization | select DisplayName, Id
在我们的示例中,组织 ID 以 d8cc 结尾。我们需要将 EvoSts – d1c9beac-0655-48e7-9949-5e497af1d38d 设置为默认授权端点。
DisplayName Id
----------- --
EXOIP d032a20d-16c9-4e5b-87c3-30b055ded8cc
在 Exchange 命令行管理程序中,运行两个 cmdlet 以在 Exchange 本地组织上启用新式身份验证。
Set-AuthServer -Identity "EvoSts - d1c9beac-0655-48e7-9949-5e497af1d38d" -IsDefaultAuthorizationEndpoint $true
Set-OrganizationConfig -OAuth2ClientProfileEnabled $true
如果 Exchange 本地版本是 Exchange 2016(CU18 或更高版本)或 Exchange 2019(CU7 或更高版本),并且使用 2020 年 9 月之后下载的 HCW 配置混合,请在本地 Exchange 命令行管理程序中运行以下命令。
将身份(从步骤 7 复制)和域名更改为您自己的。
Set-AuthServer -Identity "EvoSts - d1c9beac-0655-48e7-9949-5e497af1d38d" -DomainName "exoip.com" -IsDefaultAuthorizationEndpoint $true
Set-OrganizationConfig -OAuth2ClientProfileEnabled $true
步骤 9. 重新启动 Internet 信息服务
您可以重新启动 Exchange 服务器上的 Internet 信息服务 (IIS) 以加快该过程。
iisreset
步骤 10. Outlook 注册表要求
确保您正在运行以下支持新式身份验证的 Outlook 客户端之一。 Outlook 2010 不受支持,因此无法工作。将 Outlook 客户端升级到支持新式身份验证的版本。
| 展望版本 | 现代身份验证支持 | EnableADAL 需要注册表密钥 | AlwaysUseMSOAuthForAutodiscover 需要 reg 密钥 |
|---|---|---|---|
| 2010年展望 | 不 | 无法使用 | 无法使用 |
| 2013年展望 | 是的 | 是的 | 是的 |
| 2016年展望 | 是的 | 不 | 是的 |
| 2019年展望 | 是的 | 不 | 是的 |
| 展望365 | 是的 | 不 | 是的 |
Microsoft 建议用户通过设置强制 Outlook 使用新式身份验证双字以下注册表项的值1。
HKEY_CURRENT_USERSoftwareMicrosoftExchangeAlwaysUseMSOAuthForAutoDiscover
如果您有 Outlook 2013,则需要再添加两个双字价值观。添加双字价值1在以下注册表子项中:
HKEY_CURRENT_USERSOFTWAREMicrosoftOffice15.0CommonIdentityEnableADAL
HKEY_CURRENT_USERSOFTWAREMicrosoftOffice15.0CommonIdentityVersion
第 11 步:验证您的工作
启用混合现代身份验证后,客户端下次登录将使用新的身份验证流程。请注意,仅打开混合现代身份验证不会触发任何客户端的重新身份验证,并且 Exchange 可能需要一段时间才能获取新设置。这就是为什么一个冰重置在上一步中的 Exchange 服务器上将加快速度。
您可以按住CTRL 键和右键单击Windows 系统托盘中的 Outlook 客户端。点击连接状态。根据 Authn 类型查找客户端的 SMTP 地址持票人*,表示 OAuth 中使用的不记名令牌。
您已在 Exchange 本地组织中成功配置混合现代身份验证。
如何为 OWA 和 ECP 配置混合现代身份验证
在开始为 OWA 和 ECP 配置混合现代身份验证之前,请务必完成上一步并且一切正常。
重要的:Exchange OWA(Outlook Web Access)和ECP(Exchange 控制面板)与现代身份验证配合使用。但是,您需要安装带有 2024 年 4 月 Exchange Server 修补程序更新或更高版本的 Exchange Server 2019 CU14。
这是导航到本地 Exchange OWA 时的外观。这意味着没有为 OWA 和 ECP 配置 HMA。
OWA 和 ECP 页面需要显示 Microsoft 登录 Outlook 屏幕。这时您就知道使用了现代身份验证。
在为 OWA 和 ECP 启用混合现代身份验证之前,我们将执行以下步骤并确保一切就绪。
每次运行 cmdlet 时请仔细查看。这是因为您需要在以下位置执行管理任务:
- Exchange 命令行管理程序(本地 Exchange 服务器)
- PowerShell(Microsoft Graph PowerShell)
步骤 1. 获取 OWA 和 ECP URL
在本地 Exchange Server 上以管理员身份启动 Exchange 命令行管理程序。运行两个 cmdlet 以检索 OWA 和 ECP 虚拟目录 URL。
Get-OwaVirtualDirectory -ADPropertiesOnly | fl server, name, *url*
Get-EcpVirtualDirectory -ADPropertiesOnly | fl server, name, *url*
运行每个命令后,结果将显示在下面的输出中。记下所有内部和外部 URL,因为您需要在后续步骤之一中添加这些 URL。
在我们的示例中,内部和外部 URL 具有相同的名称。我们建议像这样配置它,因为它会简化很多。如果没有,您会在输出中看到以 .local 或 .lan 结尾的内部地址。
# Get-OwaVirtualDirectory -ADPropertiesOnly | fl server, name, *url*
Server : EX01-2019
Name : owa (Default Web Site)
Url : {}
InternalSPMySiteHostURL :
ExternalSPMySiteHostURL :
SetPhotoURL :
Exchange2003Url :
FailbackUrl :
InternalUrl : https://mail.exoip.com/owa
ExternalUrl : https://mail.exoip.com/owa
Server : EX02-2019
Name : owa (Default Web Site)
Url : {}
InternalSPMySiteHostURL :
ExternalSPMySiteHostURL :
SetPhotoURL :
Exchange2003Url :
FailbackUrl :
InternalUrl : https://mail.exoip.com/owa
ExternalUrl : https://mail.exoip.com/owa
# Get-EcpVirtualDirectory -ADPropertiesOnly | fl server, name, *url*
Server : EX01-2019
Name : ecp (Default Web Site)
InternalUrl : https://mail.exoip.com/ecp
ExternalUrl : https://mail.exoip.com/ecp
Server : EX02-2019
Name : ecp (Default Web Site)
InternalUrl : https://mail.exoip.com/ecp
ExternalUrl : https://mail.exoip.com/ecp
步骤 2. 添加本地 OWA 和 ECP URL 作为回复 URL
以管理员身份运行 PowerShell 并连接到 Microsoft Graph PowerShell。使用您的 Microsoft 365 全局管理员凭据登录。
Connect-MgGraph -Scopes "User.Read", "Application.ReadWrite.All"
使用 Microsoft Graph PowerShell 中的以下命令将 Exchange Server 本地 OWA 和 ECP URL 添加到应用程序回复 URL。
在此示例中,URL 为 https://mail.exoip.com/owa 和 https://mail.exoip.com/ecp。将 URL 替换为您自己的 URL。
$servicePrincipal = Get-MgServicePrincipal -Filter "AppId eq '00000002-0000-0ff1-ce00-000000000000'"
$servicePrincipal.ReplyUrls += "https://mail.exoip.com/owa"
$servicePrincipal.ReplyUrls += "https://mail.exoip.com/ecp"
Update-MgServicePrincipal -ServicePrincipalId $servicePrincipal.Id -AppId "00000002-0000-0ff1-ce00-000000000000" -ReplyUrls $servicePrincipal.ReplyUrls
假设您想恢复更改。更改下面的 URL 并运行命令。
$servicePrincipal = Get-MgServicePrincipal -Filter "AppId eq '00000002-0000-0ff1-ce00-000000000000'"
$servicePrincipal.ReplyUrls = $servicePrincipal.ReplyUrls | Where-Object { $_ -ne "https://mail.exoip.com/owa" -and $_ -ne "https://mail.exoip.com/ecp" }
Update-MgServicePrincipal -ServicePrincipalId $servicePrincipal.Id -ReplyUrls $servicePrincipal.ReplyUrls
步骤 3. 验证 Exchange 回复 URL
验证您是否将 Exchange Server OWA 和 ECP URL 添加到应用程序回复 URL。运行获取 MgServicePrincipalMicrosoft Graph PowerShell 中的 cmdlet。
(Get-MgServicePrincipal -Filter "AppId eq '00000002-0000-0ff1-ce00-000000000000'").ReplyUrls
按照我们的示例,URL 列表现在包括特定 URL https://mail.exoip.com/owa 和 https://mail.exoip.com/ecp。在列表顶部查看它。
https://mail.exoip.com/ecp
https://mail.exoip.com/owa
https://outlook.cloud.microsoft
https://outlook-sdf.cloud.microsoft
https://sdfpilot.outlook.com/owa
步骤 4. 设置下载域的全局覆盖
如果您已在 Exchange Server 上配置了下载域,则仅在一台 Exchange Server 上的 Exchange 命令行管理程序中运行以下命令。如果没有,请跳过此步骤。
New-SettingOverride -Name "OWA HMA Download Domain Support" -Component "OAuth" -Section "OAuthIdentityCacheFixForDownloadDomains" -Parameters ("Enabled=true") -Reason "Enable support for OWA HMA when Download Domains are in use"
Get-ExchangeDiagnosticInfo -Process Microsoft.Exchange.Directory.TopologyService -Component VariantConfiguration -Argument Refresh
Restart-Service -Name W3SVC, WAS -Force
步骤 5. 获取虚拟目录身份验证方法状态
在 Exchange 命令行管理程序中运行 cmdlet 以检索 OWA 和 ECP 虚拟目录身份验证方法状态。
Get-OwaVirtualDirectory -Server "EX01-2019" | fl server, *auth*
Get-EcpVirtualDirectory -Server "EX02-2019" | fl server, *auth*
运行每个命令后,结果将显示在下面的输出中。
# Get-OwaVirtualDirectory -Server "EX01-2019" | fl server, *auth*
Server : EX01-2019
ClientAuthCleanupLevel : High
InternalAuthenticationMethods : {Basic, Fba, Adfs}
BasicAuthentication : True
WindowsAuthentication : False
DigestAuthentication : False
FormsAuthentication : True
LiveIdAuthentication : False
AdfsAuthentication : False
OAuthAuthentication : False
ExternalAuthenticationMethods : {Fba}
# Get-EcpVirtualDirectory -Server "EX01-2019" | fl server, *auth*
Server : EX01-2019
InternalAuthenticationMethods : {Basic, Fba, Adfs}
BasicAuthentication : True
WindowsAuthentication : False
DigestAuthentication : False
FormsAuthentication : True
LiveIdAuthentication : False
AdfsAuthentication : True
OAuthAuthentication : False
ExternalAuthenticationMethods : {Fba}
步骤 6. 禁用 OWA 和 ECP 上的身份验证方法
对每个 Exchange Server 上的 OWA 和 ECP 虚拟目录禁用任何其他身份验证方法。在 Exchange 命令行管理程序中运行命令。
Get-OwaVirtualDirectory -Server "EX01-2019" | Set-OwaVirtualDirectory -AdfsAuthentication $false -BasicAuthentication $false -FormsAuthentication $false -DigestAuthentication $false
Get-EcpVirtualDirectory -Server "EX01-2019" | Set-EcpVirtualDirectory -AdfsAuthentication $false -BasicAuthentication $false -FormsAuthentication $false -DigestAuthentication $false
Get-OwaVirtualDirectory -Server "EX02-2019" | Set-OwaVirtualDirectory -AdfsAuthentication $false -BasicAuthentication $false -FormsAuthentication $false -DigestAuthentication $false
Get-EcpVirtualDirectory -Server "EX02-2019" | Set-EcpVirtualDirectory -AdfsAuthentication $false -BasicAuthentication $false -FormsAuthentication $false -DigestAuthentication $false
步骤 7. 为 OWA 和 ECP 启用混合现代身份验证
为每个 Exchange Server 上的 OWA 和 ECP 虚拟目录启用 OAuth。在 Exchange 命令行管理程序中运行命令。
Get-EcpVirtualDirectory -Server "EX01-2019" | Set-EcpVirtualDirectory -OAuthAuthentication $true
Get-OwaVirtualDirectory -Server "EX01-2019" | Set-OwaVirtualDirectory -OAuthAuthentication $true
Get-EcpVirtualDirectory -Server "EX02-2019" | Set-EcpVirtualDirectory -OAuthAuthentication $true
Get-OwaVirtualDirectory -Server "EX02-2019" | Set-OwaVirtualDirectory -OAuthAuthentication $true
第 8 步:验证您的工作
应用上述配置后,无需重新启动 IIS 或 Exchange Server 即可使更改生效。
笔记:确保您的管理员帐户已同步到 Microsoft Entra ID;否则,您将无法登录 ECP。默认管理员帐户不会同步到 Microsoft Entra ID,并且您无法使用它登录。在任何情况下,您都应该在生产环境中禁用默认管理员帐户以减少攻击面。
更多阅读:为 Exchange Server 配置 Kerberos 身份验证
打开 Web 浏览器并填写 Exchange Server OWA 或 ECP URL。您将立即看到 Microsoft 登录 Outlook 屏幕。
填写凭据后,您将被重定向到 Exchange Server 本地 OWA 或 ECP URL。
您已成功在 Exchange 本地组织中为 OWA 和 ECP 配置混合现代身份验证。
就是这样!
结论
您了解了如何在本地 Exchange 中配置混合现代身份验证。按照以下步骤在 Exchange Online 和本地 Exchange 之间配置 OAuth。设置完成后,Outlook 客户端和 OWA/ECP 都会受到保护。
您喜欢这篇文章吗?您可能还喜欢迁移到 Office 365 后 Outlook 提示输入密码。不要忘记关注我们并分享本文。
