admin管理员组文章数量:1323731
How can I filter for a specific IP address through the Microsoft Entra Audit logs?
I tried following two PowerShell commands:
Get-MgAuditLogDirectoryAudit -All -Property * -Filter "initiatedBy/user/ipAddress eq '$IpAddress'"
Get-MgBetaAuditLogDirectoryAudit -All -Property * -Filter "initiatedBy/user/ipAddress eq '$IpAddress'"
Following filter query works:
Get-MgAuditLogDirectoryAudit -All -Property * -Filter "initiatedBy/user/userPrincipalName eq '$UPN'"
How can I filter for a specific IP address through the Microsoft Entra Audit logs?
I tried following two PowerShell commands:
Get-MgAuditLogDirectoryAudit -All -Property * -Filter "initiatedBy/user/ipAddress eq '$IpAddress'"
Get-MgBetaAuditLogDirectoryAudit -All -Property * -Filter "initiatedBy/user/ipAddress eq '$IpAddress'"
Following filter query works:
Get-MgAuditLogDirectoryAudit -All -Property * -Filter "initiatedBy/user/userPrincipalName eq '$UPN'"
Share
Improve this question
edited Jan 12 at 6:20
user3022917
asked Jan 12 at 6:14
user3022917user3022917
6172 gold badges11 silver badges21 bronze badges
3 Answers
Reset to default 1See the API documentation, they never state that filtering on ipAddress
is supported:
Indicates information about the user or app initiated the activity. Supports
$filter
(eq
) for user/id, user/displayName, user/userPrincipalName, app/appId, app/displayName; and$filter
(startswith
) for user/userPrincipalName.
If you want to filter by ipAddress
server side you can do so via KQL query to AuditLogs
table assuming you're storing the logs in Log Analytics or Azure Data Explorer, i.e.:
AuditLogs
| where initiatedBy.user.ipAddress == "$IpAddress"
My current attempt:
Get-MgAuditLogDirectoryAudit -All -Property * -Search '"ipAddress:$IpAddress"'
But it seems that the results are bogus.
My solution:
[Array]$Records = Get-MgBetaAuditLogDirectoryAudit -All
$Records | Where-Object {$_.InitiatedBy.User.IPAddress -eq "$IpAddress"}
Why not using the logs you already paid for?
Who wants to invest extra money for LogAnalytics, Splunk, etc. can do this. ;-)
本文标签:
版权声明:本文标题:powershell - How can I filter via Get-MgAuditLogDirectoryAudit (through the Microsoft Entra Audit Logs) for a specific IP addres 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742121919a2421750.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论