Exchange Server OAuth 证书过期,无法登录到 Outlook 网页版 或 EAC
遗漏从 Exchange 服务器具有用于签署 OAuth 的 Exchange 服务器验证凭证时,就会发生这个问题。您可以执行下列命令以检查凭证是否遗失:
Get-ExchangeCertificate (Get-AuthConfig).CurrentCertificateThumbprint
要查看现有 OAuth 证书的状态,请在 Exchange Management Shell 中运行以下命令:
(Get-AuthConfig).CurrentCertificateThumbprint | Get-ExchangeCertificate | Format-List
注意:接下来的程序将会产生一张新的OAuth凭证并发布至组织中的每一台Exchange服务器,并且需要等待生效时间才能成功登入至OWA/ECP
如果命令返回错误或证书已过期,请使用以下步骤新建 OAuth 证书并将其部署到 Exchange Server:
1. 执行下列命令,以建立新的 OAuth 认证:
New-ExchangeCertificate -KeySize 2048 -PrivateKeyExportable $true -SubjectName "cn=Microsoft Exchange Server Auth Certificate" -FriendlyName "Microsoft Exchange Server Auth Certificate" -DomainName "sohu.com.cn"
*产生新凭证后,会提示是否取代现有的SMTP凭证,请输入’N’
2. 设置服务器身份验证的新证书以进行服务器验证,执行下列三条命令:
Set-AuthConfig -NewCertificateThumbprint <ThumbprintFromStep1> -NewCertificateEffectiveDate (Get-Date)
例如: Set-AuthConfig -NewCertificateThumbprint 22E29062AC6AC2902D28A58D89EC3BDA35BDEBD5 -NewCertifica
teEffectiveDate 5/20/2023
Set-AuthConfig -PublishCertificate
Set-AuthConfig -ClearPreviousCertificate
*AuthConfig 的OAuth凭证更新需要将凭证发布至各个服务器,因此,当此凭证曾经在环境中作过更新,则正常情况下,组织中所有的Exchange服务器应该都要有相同ID、相同有效日期的验证证书,才是完整的Auth更新。
3. 重新启动 Microsoft Exchange Service Host 服务
*该服务为应用程序提供主机级部署和管理服务。
4. 运行 IISReset 命令重启 IIS 或运行以下命令(在提升模式下)以回收 OWA 和 EAC 的应用程序池:
Restart-WebAppPool MSExchangeOWAAppPool
Restart-WebAppPool MSExchangeECPAppPool
*在某些环境中,可能需要一小时才能发布OAuth 凭证并且需要约8-12小时的时间让AuthConfig的设定在各服务器中完全生效。设置的时候提示48小时生效。实际 20-30小时内生效。
*如果您有混合式设定,则必须重新执行混合式设定向导,以更新Azure Active Directory (Azure AD) 的变更。
____________________________________________________________________________________________________
欢迎使用 Exchange 命令行管理程序!
cmdlet 的完整列表: Get-Command
仅 Exchange cmdlet: Get-ExCommand
与特定字符串匹配的 cmdlet: 帮助 *<string>*
获取常规帮助: 帮助
获取有关 cmdlet 的帮助: Help <cmdlet name> 或 <cmdlet name> -?
Exchange 团队博客: Get-ExBlog
显示命令的完整输出: <command> | Format-List
显示快速参考指南: QuickRef
第 #68 天的提示:
Exchange 2013 使用管理角色组和管理角色分配策略来管理权限。
使用角色组可以为管理员组和专家级最终用户组授予权限。这些人负责管理组织或执行特殊任务,例如为遵从性原因而进行邮箱搜索。
使用角色分配策略可以为最终用户授予权限。这些权限包括用户是否可以管理自己的通讯组、编辑自己的配置文件信息、访问语音邮件等。
[PS] C:\Windows\system32>Get-ExchangeCertificate (Get-AuthConfig).CurrentCertificateThumbprint
Thumbprint Services Subject
---------- -------- -------
C31ADC48484104E6DF6D0E14F6BC555A46A9FF6D ....S.. CN=Microsoft Exchange Server Auth Certificate
[PS] C:\Windows\system32>(Get-AuthConfig).CurrentCertificateThumbprint | Get-ExchangeCertificate | Format-List
AccessRules : {System.Security.AccessControl.CryptoKeyAccessRule, System.Security.AccessControl.CryptoKeyAccessR
ule, System.Security.AccessControl.CryptoKeyAccessRule, System.Security.AccessControl.CryptoKeyAcc
essRule}
CertificateDomains : {}
HasPrivateKey : True
IsSelfSigned : True
Issuer : CN=Microsoft Exchange Server Auth Certificate
NotAfter : 2022/10/19 12:00:27
NotBefore : 2017/11/14 12:00:27
PublicKeySize : 2048
RootCAType : Unknown
SerialNumber : 25E349B45D0B4D864775D68239ADF657
Services : SMTP
Status : Invalid
Subject : CN=Microsoft Exchange Server Auth Certificate
Thumbprint : C31ADC48484104E6DF6D0E14F6BC555A46A9FF6D
[PS] C:\Windows\system32>New-ExchangeCertificate -KeySize 2048 -PrivateKeyExportable $true -SubjectName "cn=Microsoft Ex
change Server Auth Certificate" -FriendlyName "Microsoft Exchange Server Auth Certificate" -DomainName "sohu.com.cn"
确认
是否覆盖现有默认的 SMTP 证书?
当前证书:'3B77D59977909981570F7E2E36EBF7CE9C3F0DB9'(在 2023/11/15 9:57:15 后过期)
使用证书:'22E29062AC6AC2902D28A58D89EC3BDA35BDEBD5'(在 2028/5/19 14:24:30 后过期) 替换此证书
[Y] 是(Y) [A] 全是(A) [N] 否(N) [L] 全否(L) [?] 帮助 (默认值为“Y”): n
Thumbprint Services Subject
---------- -------- -------
22E29062AC6AC2902D28A58D89EC3BDA35BDEBD5 ....S.. CN=Microsoft Exchange Server Auth Certificate
[PS] C:\Windows\system32>Set-AuthConfig -NewCertificateThumbprint 22E29062AC6AC2902D28A58D89EC3BDA35BDEBD5 -NewCertifica
teEffectiveDate 5/19/2023
新证书生效日期无效。生效日期必须在当前时间之后。
+ CategoryInfo : InvalidArgument: (:) [Set-AuthConfig],TaskException
+ FullyQualifiedErrorId : [Server=EX01,RequestId=d1a8b1e9-f18d-4fcc-a2a4-58fe54f50c53,TimeStamp=2023/5/19 6:59:17]
[FailureCategory=Cmdlet-TaskException] DA9BEF16,Microsoft.Exchange.Management.SystemConfigurationTasks.SetAuthCon
fig
+ PSComputerName : ex01.sohu.com.cn
[PS] C:\Windows\system32>Set-AuthConfig -NewCertificateThumbprint 22E29062AC6AC2902D28A58D89EC3BDA35BDEBD5 -NewCertifica
teEffectiveDate 5/20/2023
确认
新证书生效日期至少在“48”小时后才能生效,且可能不会在所有所需服务器上部署。是否要继续?
[Y] 是(Y) [A] 全是(A) [N] 否(N) [L] 全否(L) [?] 帮助 (默认值为“Y”): y
[PS] C:\Windows\system32>Set-AuthConfig -PublishCertificate
确认
尚未达到新证书生效日期。是否仍要发布新证书“22E29062AC6AC2902D28A58D89EC3BDA35BDEBD5”作为当前证书?
[Y] 是(Y) [A] 全是(A) [N] 否(N) [L] 全否(L) [?] 帮助 (默认值为“Y”): y
[PS] C:\Windows\system32>Set-AuthConfig -ClearPreviousCertificate
[PS] C:\Windows\system32>(Get-AuthConfig).CurrentCertificateThumbprint | Get-ExchangeCertificate | Format-List
AccessRules : {System.Security.AccessControl.CryptoKeyAccessRule, System.Security.AccessControl.CryptoKeyAccessR
ule, System.Security.AccessControl.CryptoKeyAccessRule}
CertificateDomains : {sohu.com.cn}
HasPrivateKey : True
IsSelfSigned : True
Issuer : CN=Microsoft Exchange Server Auth Certificate
NotAfter : 2028/5/19 14:24:30
NotBefore : 2023/5/19 14:24:30
PublicKeySize : 2048
RootCAType : None
SerialNumber : 60B1EC4C0E1375AB4AEA84BEAFF1FB90
Services : SMTP
Status : Valid
Subject : CN=Microsoft Exchange Server Auth Certificate
Thumbprint : 22E29062AC6AC2902D28A58D89EC3BDA35BDEBD5
[PS] C:\Windows\system32>Restart-WebAppPool MSExchangeOWAAppPool
[PS] C:\Windows\system32>Restart-WebAppPool MSExchangeECPAppPool
[PS] C:\Windows\system32>

浙公网安备 33010602011771号