有关 Microsoft Entra 监视和运行状况的 Microsoft Graph PowerShell cmdlet

借助 Microsoft Entra 监视和运行状况,可以获取目录(审核日志)和身份验证数据(登录日志)中所有写入操作相关的活动的详细信息。 虽然这些信息是使用 Microsoft Graph API 提供的,但现在可以使用有关标识监视和运行状况的 Microsoft Graph PowerShell cmdlet 来检索相同的数据。

本文概述了用于审核日志和登录日志的 Microsoft Graph PowerShell cmdlet。 Microsoft Graph PowerShell 入门

审核日志

审核日志通过日志为 Microsoft Entra ID 中的各种功能所做的所有更改提供可跟踪性。 审核日志的示例包括对 Microsoft Entra ID 中的任何资源所做的更改,例如添加或删除用户、应用、组、角色和策略。

可以使用 Get-MgAuditLogDirectoryAudit cmdlet 访问审核日志。

方案 PowerShell 命令
应用程序显示名称 Get-MgAuditLogDirectoryAudit -Filter "initiatedBy/app/displayName eq 'Azure AD Cloud Sync'"
类别 Get-MgAuditLogDirectoryAudit -Filter "category eq 'ApplicationManagement'"
活动日期时间 Get-MgAuditLogDirectoryAudit -Filter "activityDateTime gt 2019-04-18"
以上都是 Get-MgAuditLogDirectoryAudit -Filter "initiatedBy/app/displayName eq 'Azure AD Cloud Sync' and category eq 'ApplicationManagement' and activityDateTime gt 2019-04-18"

登录日志

登录日志提供有关托管应用程序的使用情况和用户登录活动的信息。

可以使用 Get-MgAuditLogSignIn cmdlet 访问登录日志。 请使用下表获取更多方案。

方案 Microsoft Graph PowerShell 命令
用户显示名称 Get-MgAuditLogSignIn -Filter "userDisplayName eq 'Timothy Perkins'"
创建日期时间 Get-MgAuditLogSignIn -Filter "createdDateTime gt 2023-04-18T17:30:00.0Z"(自 4/18 下午 5:30 起的所有内容)
状态 Get-MgAuditLogSignIn -Filter "status/errorCode eq 50105"
应用程序显示名称 Get-MgAuditLogSignIn -Filter "appDisplayName eq 'StoreFrontStudio [wsfed enabled]'"
以上都是 Get-MgAuditLogSignIn -Filter "userDisplayName eq 'Timothy Perkins' and status/errorCode ne 0 and appDisplayName eq 'StoreFrontStudio [wsfed enabled]'"

后续步骤