监视和查看本地 Microsoft Entra 密码保护环境的日志

部署 Microsoft Entra Password Protection 后,监视和报告是关键任务。 本文详细介绍了如何帮助你了解各种监视技术,包括每个服务记录信息的位置以及如何报告Microsoft Entra 密码保护的使用情况。

监视和报告通过事件日志消息或运行 PowerShell cmdlet 来完成。 DC 代理和代理服务都记录事件日志消息。 下面所述的所有 PowerShell cmdlet 仅可用于代理服务器(请参阅 AzureADPasswordProtection PowerShell 模块)。 DC 代理软件不安装 PowerShell 模块。

DC 代理事件日志记录

在每个域控制器上,DC 代理服务软件将每个单独的密码验证作(和其他状态)的结果写入本地事件日志:

\Applications and Services Logs\Microsoft\AzureADPasswordProtection\DCAgent\Admin

\Applications and Services Logs\Microsoft\AzureADPasswordProtection\DCAgent\Operational

\Applications and Services Logs\Microsoft\AzureADPasswordProtection\DCAgent\Trace

DC 代理管理日志是软件行为方式信息的主要来源。

请注意,跟踪日志默认处于关闭状态。

各种 DC 代理组件记录的事件属于以下范围:

组件 事件 ID 范围
DC 代理密码筛选器 dll 10000-19999
DC 代理服务托管过程 20000-29999
DC 代理服务策略验证逻辑 30000-39999

DC 代理管理员事件日志

密码验证结果事件

在每个域控制器上,DC 代理服务软件将每个密码验证的结果写入 DC 代理管理员事件日志。

对于成功的密码验证操作,通常会从 DC 代理密码筛选器 DLL 记录一个事件。 对于失败的密码验证作,通常记录两个事件,一个来自 DC 代理服务,一个来自 DC 代理密码筛选器 dll。

根据以下因素记录用于捕获这些情况的离散事件:

  • 是在设置还是更改给定的密码。
  • 给定密码的验证结果是成功还是失败。
  • 验证是否由于Microsoft全局策略、组织策略或组合而失败。
  • 目前是对当前密码策略启用还是禁用了仅限审核模式。

密钥密码验证相关事件如下所示:

事件 密码更改 密码已设置
通过 10014 10015
失败(由于客户密码策略) 10016, 30002 10017, 30003
失败(由于Microsoft密码策略) 10016, 30004 10017, 30005
失败(因 Microsoft 密码策略和客户密码策略这两种策略所致) 10016, 30026 10017, 30027
失败(由于用户名) 10016, 30021 10017, 30022
仅限审核通过(未通过客户密码策略验证) 10024, 30008 10025, 30007
仅限审核通过(未通过 Microsoft 密码策略验证) 10024, 30010 10025, 30009
仅审核通过(未通过 Microsoft 密码策略和客户密码策略这两种策略的验证) 10024, 30028 10025, 30029
仅审核通过(因用户名所致未通过) 10016, 30024 10017, 30023

上表中引用“组合策略”的情况是指发现用户的密码至少包含来自Microsoft禁止密码列表和客户禁止密码列表的一个令牌的情况。

上表中引用“用户名”的情况是指发现用户的密码包含用户帐户名和/或用户友好名称之一的情况。 策略设置为“强制”时,任一方案都会导致用户的密码被拒绝,而在策略处于审核模式时,则会被接受。

当一对事件被一起记录时,这两个事件通过相同的 CorrelationId 被显式关联。

通过 PowerShell 报告密码验证摘要

Get-AzureADPasswordProtectionSummaryReport cmdlet 可用于生成密码验证活动的摘要视图。 此 cmdlet 的示例输出如下所示:

Get-AzureADPasswordProtectionSummaryReport -DomainController bplrootdc2
DomainController                : bplrootdc2
PasswordChangesValidated        : 6677
PasswordSetsValidated           : 9
PasswordChangesRejected         : 10868
PasswordSetsRejected            : 34
PasswordChangeAuditOnlyFailures : 213
PasswordSetAuditOnlyFailures    : 3
PasswordChangeErrors            : 0
PasswordSetErrors               : 1

可以使用 –Forest、-Domain 和 –DomainController 参数之一来影响 cmdlet 的报告范围。 未指定参数等同于使用“–Forest”参数。

注释

如果仅在一个 DC 上安装 DC 代理,Get-AzureADPasswordProtectionSummaryReport 将仅从该 DC 读取事件。 若要从多个 DC 获取事件,需要在每个 DC 上安装 DC 代理。

Get-AzureADPasswordProtectionSummaryReport cmdlet 的工作原理是查询 DC 代理管理员事件日志,然后对对应于每个显示的结果类别的事件总数进行计数。 下表包含每个结果与其相应事件 ID 之间的映射:

Get-AzureADPasswordProtectionSummaryReport property 相应的事件 ID
密码更改已验证 10014
PasswordSetsValidated 10015
密码更改被拒绝 10016
PasswordSetsRejected 10017
PasswordChangeAuditOnlyFailures 10024
PasswordSetAuditOnlyFailures 10025
密码更改错误 10012
密码设置错误 10013

请注意, Get-AzureADPasswordProtectionSummaryReport cmdlet 以 PowerShell 脚本形式提供,如果需要,可以直接在以下位置引用:

%ProgramFiles%\WindowsPowerShell\Modules\AzureADPasswordProtection\Get-AzureADPasswordProtectionSummaryReport.ps1

注释

此 cmdlet 的工作原理是向每个域控制器打开 PowerShell 会话。 若要成功,必须在每个域控制器上启用 PowerShell 远程会话支持,并且客户端必须具有足够的权限。 有关 PowerShell 远程会话要求的详细信息,请在 PowerShell 窗口中运行“Get-Help about_Remote_Troubleshooting”。

注释

此 cmdlet 的工作原理是远程查询每个 DC 代理服务的管理员事件日志。 如果事件日志包含大量事件,则 cmdlet 可能需要很长时间才能完成。 此外,大型数据集的批量网络查询可能会影响域控制器性能。 因此,此 cmdlet 应在生产环境中谨慎使用。

示例事件日志消息

事件 ID 10014(密码更改成功)

The changed password for the specified user was validated as compliant with the current Azure password policy.

UserName: SomeUser
FullName: Some User

事件 ID 10017(密码更改失败):

The reset password for the specified user was rejected because it did not comply with the current Azure password policy. Please see the correlated event log message for more details.

UserName: SomeUser
FullName: Some User

事件 ID 30003(密码更改失败):

The reset password for the specified user was rejected because it matched at least one of the tokens present in the per-tenant banned password list of the current Azure password policy.

UserName: SomeUser
FullName: Some User

事件 ID 10024(由于策略处于仅审核模式,因此已接受密码)

The changed password for the specified user would normally have been rejected because it did not comply with the current Azure password policy. The current Azure password policy is con-figured for audit-only mode so the password was accepted. Please see the correlated event log message for more details. 
 
UserName: SomeUser
FullName: Some User

事件 ID 30008(由于策略处于仅审核模式,因此已接受密码)

The changed password for the specified user would normally have been rejected because it matches at least one of the tokens present in the per-tenant banned password list of the current Azure password policy. The current Azure password policy is configured for audit-only mode so the password was accepted. 

UserName: SomeUser
FullName: Some User

事件 ID 30001(由于没有可用的策略,因此已接受密码)

The password for the specified user was accepted because an Azure password policy is not available yet

UserName: SomeUser
FullName: Some User

This condition may be caused by one or more of the following reasons:%n

1. The forest has not yet been registered with Azure.

   Resolution steps: an administrator must register the forest using the Register-AzureADPasswordProtectionForest cmdlet.

2. An Azure AD password protection Proxy is not yet available on at least one machine in the current forest.

   Resolution steps: an administrator must install and register a proxy using the Register-AzureADPasswordProtectionProxy cmdlet.

3. This DC does not have network connectivity to any Azure AD password protection Proxy instances.

   Resolution steps: ensure network connectivity exists to at least one Azure AD password protection Proxy instance.

4. This DC does not have connectivity to other domain controllers in the domain.

   Resolution steps: ensure network connectivity exists to the domain.

事件 ID 30006(正在强制执行的新策略)

The service is now enforcing the following Azure password policy.

 Enabled: 1
 AuditOnly: 1
 Global policy date: ‎2018‎-‎05‎-‎15T00:00:00.000000000Z
 Tenant policy date: ‎2018‎-‎06‎-‎10T20:15:24.432457600Z
 Enforce tenant policy: 1

事件 ID 30019 (Microsoft Entra Password Protection 已禁用)

The most recently obtained Azure password policy was configured to be disabled. All passwords submitted for validation from this point on will automatically be considered compliant with no processing performed.

No further events will be logged until the policy is changed.%n

DC 代理操作日志

DC 代理服务还将把与操作相关的事件记录到以下日志中:

\Applications and Services Logs\Microsoft\AzureADPasswordProtection\DCAgent\Operational

DC 代理跟踪日志

DC 代理服务还会将详细的调试级别跟踪事件记录到以下日志:

\Applications and Services Logs\Microsoft\AzureADPasswordProtection\DCAgent\Trace

默认情况下禁用跟踪日志记录。

警告

启用后,跟踪日志会收到大量事件,并可能会影响域控制器性能。 因此,仅当问题需要更深入的调查时,才应启用此增强日志,然后只需花费最少的时间。

DC 代理文本日志记录

可以通过设置以下注册表值,将 DC 代理服务配置为写入文本日志:

HKLM\System\CurrentControlSet\Services\AzureADPasswordProtectionDCAgent\Parameters!EnableTextLogging = 1 (REG_DWORD value)

默认情况下禁用文本日志记录。 需要重启 DC 代理服务才能使此值的更改生效。 启用后,DC 代理服务会写入到以下目录下的日志文件:

%ProgramFiles%\Azure AD Password Protection DC Agent\Logs

小窍门

文本日志接收与可记录到跟踪日志的调试级别相同的条目,但通常采用更简便的格式以便查看和分析。

警告

启用后,此日志会收到大量事件,并可能会影响域控制器性能。 因此,仅当问题需要更深入的调查时,才应启用此增强日志,然后只需花费最少的时间。

DC 代理性能监视

DC 代理服务软件安装 一个名为Microsoft Entra Password Protection 的性能计数器对象。 目前提供以下性能计数器:

Perf 计数器名称 DESCRIPTION
已处理的密码 此计数器显示自上次重启以来处理的密码总数(已接受或拒绝)。
接受的密码 此计数器显示自上次重启以来接受的密码总数。
拒绝的密码 此计数器显示自上次重启以来被拒绝的密码总数。
密码筛选器请求正在进行中 此计数器显示当前正在进行的密码筛选器请求数。
峰值密码筛选器请求 此计数器显示自上次重启以来并发密码筛选器请求的峰值数。
密码筛选器请求错误 此计数器显示自上次重启以来因错误而失败的密码筛选器请求总数。 Microsoft Entra Password Protection DC 代理服务未运行时,可能会出现错误。
密码筛选器请求数/秒 此计数器显示正在处理密码的速率。
密码筛选器请求处理时间 此计数器显示处理密码筛选器请求所需的平均时间。
峰值密码筛选器请求处理时间 此计数器显示自上次重启以来的密码筛选器请求处理时间的峰值。
由于审核模式而接受的密码数 此计数器显示通常被拒绝但已接受的密码总数,因为密码策略配置为处于审核模式(自上次重启以来)。

DC 代理发现

Get-AzureADPasswordProtectionDCAgent cmdlet 可用于显示域或林中运行的各个 DC 代理的基本信息。 此信息是从正在运行的 DC 代理服务注册的 serviceConnectionPoint 对象(s)中检索的。

此 cmdlet 的示例输出如下所示:

Get-AzureADPasswordProtectionDCAgent
ServerFQDN            : bplChildDC2.bplchild.bplRootDomain.com
Domain                : bplchild.bplRootDomain.com
Forest                : bplRootDomain.com
PasswordPolicyDateUTC : 2/16/2018 8:35:01 AM
HeartbeatUTC          : 2/16/2018 8:35:02 AM

每个 DC 代理服务大约每隔一小时更新各种属性。 数据仍受 Active Directory 复制延迟的约束。

cmdlet 查询的范围可能会受到 –Forest 或 –Domain 参数的影响。

如果 HeartbeatUTC 值变得过期,这可能是因为该域控制器上的 Microsoft Entra Password Protection DC 代理没有运行,或者已经被卸载,或者该计算机已被降级且不再作为域控制器。

如果 PasswordPolicyDateUTC 值过时,则可能是计算机上Microsoft Entra Password Protection DC 代理无法正常工作的症状。

DC 代理较新版本可用

DC 代理服务会在检测到较新版本的 DC 代理软件可用时,将 30034 警告事件记录到作日志,例如:

An update for Azure AD Password Protection DC Agent is available.

If autoupgrade is enabled, this message may be ignored.

If autoupgrade is disabled, refer to the following link for the latest version available:

https://aka.ms/AzureADPasswordProtectionAgentSoftwareVersions

Current version: 1.2.116.0

上述事件未指定较新的软件的版本。 应该访问活动消息中的链接以获取该信息。

注释

尽管上述事件消息中引用了“autoupgrade”,但 DC 代理软件目前不支持此功能。

代理服务事件日志记录

代理服务向以下事件日志发出最少的事件集:

\Applications and Services Logs\Microsoft\AzureADPasswordProtection\ProxyService\Admin

\Applications and Services Logs\Microsoft\AzureADPasswordProtection\ProxyService\Operational

\Applications and Services Logs\Microsoft\AzureADPasswordProtection\ProxyService\Trace

请注意,跟踪日志默认处于关闭状态。

警告

启用后,跟踪日志会收到大量事件,这可能会影响代理主机的性能。 因此,仅当问题需要更深入的调查时,才应启用此日志,然后只需花费最少的时间。

事件由各种代理组件使用以下范围记录:

组件 事件 ID 范围
代理服务托管过程 10000-19999
代理服务核心业务逻辑 20000-29999
PowerShell cmdlet 30000-39999

代理服务文本日志记录

可以通过设置以下注册表值,将代理服务配置为写入文本日志:

HKLM\System\CurrentControlSet\Services\AzureADPasswordProtectionProxy\Parameters!EnableTextLogging = 1(REG_DWORD 值)

默认情况下禁用文本日志记录。 需要重新启动代理服务才能使此值的更改生效。 启用代理服务后,将写入位于以下位置的日志文件:

%ProgramFiles%\Azure AD Password Protection Proxy\Logs

小窍门

文本日志接收与可记录到跟踪日志的调试级别相同的条目,但通常采用更简便的格式以便查看和分析。

警告

启用后,此日志会收到大量事件,并可能会影响计算机的性能。 因此,仅当问题需要更深入的调查时,才应启用此增强日志,然后只需花费最少的时间。

PowerShell cmdlet 日志记录

导致状态更改(例如,Register-AzureADPasswordProtectionProxy)的 PowerShell cmdlet 通常会将结果事件记录到作日志。

此外,大多数Microsoft Entra Password Protection PowerShell cmdlet 都会写入位于以下位置的文本日志:

%ProgramFiles%\Azure AD Password Protection Proxy\Logs

如果出现 cmdlet 错误,并且原因和/或解决方案不明显,可以查阅这些文本日志。

代理发现

Get-AzureADPasswordProtectionProxy cmdlet 可用于显示域或林中运行的各个 Microsoft Entra 密码保护代理服务的基本信息。 此信息是从正在运行的代理服务注册的 serviceConnectionPoint 对象(s)中检索的。

此 cmdlet 的示例输出如下所示:

Get-AzureADPasswordProtectionProxy
ServerFQDN            : bplProxy.bplchild2.bplRootDomain.com
Domain                : bplchild2.bplRootDomain.com
Forest                : bplRootDomain.com
HeartbeatUTC          : 12/25/2018 6:35:02 AM

每个代理服务大约每小时更新各种属性。 数据仍受 Active Directory 复制延迟的约束。

cmdlet 查询的范围可能会受到 –Forest 或 –Domain 参数的影响。

如果 HeartbeatUTC 值过期,这可能表明该计算机上的 Microsoft Entra Password Protection 代理未运行或已被卸载。

代理更新的版本可用

代理服务在检测到代理软件的较新版本可用时,会将 20002 警告事件记录到作日志,例如:

An update for Azure AD Password Protection Proxy is available.

If autoupgrade is enabled, this message may be ignored.

If autoupgrade is disabled, refer to the following link for the latest version available:

https://aka.ms/AzureADPasswordProtectionAgentSoftwareVersions

Current version: 1.2.116.0
.

上述事件未指定较新的软件的版本。 应该访问活动消息中的链接以获取该信息。

即使代理代理配置为启用了自动升级,也会发出此事件。

后续步骤

Microsoft Entra 密码保护故障排除

有关全局和自定义禁止密码列表的详细信息,请参阅 禁止错误密码