【问题标题】:Get Azure AD AuditLogs using powershell cmd-let/REST API使用 powershell cmdlet/REST API 获取 Azure AD 审核日志
【发布时间】:2019-09-10 13:11:32
【问题描述】:

我需要获取有关对目录角色所做更改的信息(例如全局管理员)我需要详细信息,例如用户名 - A)进行更改的用户,B)时间戳,C)操作 - 将用户添加到组或删除,D) 已添加用户的组的名称。我在 Azure 门户上更新了 AD 模块,现在我有了 AzureADPreview,我正在使用 cmd-let --> Get-AzureADAuditDirectoryLogs。作为输出,我只能得到:A)B)和C)。我检查了输出中的所有“Id”,但没有找到目录角色 ID。有没有使用提到的 PowerShell 命令捕获此信息的方法-> (D)?下面,我使用的命令:

Get-AzureADAuditDirectoryLogs -Filter "activityDateTime gt 2019-08-25" | where-object activitydisplayname -eq "Add member to group" | fl *
Get-AzureADAuditDirectoryLogs -Filter "activityDateTime gt 2019-09-01" | where-object activitydisplayname -eq "remove member from group"

更新:

我使用 Rest API 来获取所需信息:

$request = "https://graph.windows.net/xxx.com/activities/audit?api-version=beta"

$authHeader = @{  
'Content-Type'='application/json'  
'Accept'='application/json'  
'Authorization'= ("Bearer $personalToken")  
}  

$output = Invoke-RestMethod -Uri $request -Method Get -ContentType "application/json" -Headers $authHeader  
$output.value  

在输出中,仍然看不到有关用户已添加到的组的信息。

【问题讨论】:

    标签: azure azure-active-directory azure-powershell azure-ad-graph-api


    【解决方案1】:

    我不确定为什么没有返回组的名称。

    但组的对象 ID 会显示在结果中。

    使用Get-AzureADGroup -ObjectId {Object ID} 获取其名称信息。

    【讨论】:

    • 我已经更正了命令,现在我有了 --> Get-AzureADAuditDirectoryLogs -Filter "activityDateTime gt 2019-08-25" | where-object activitydisplayname -eq "将成员添加到角色"。我可以找到关于组的信息,但是您的提示是好的,谢谢,我们可以在输出组 ID 中找到。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-25
    • 2021-01-31
    • 1970-01-01
    • 2019-10-02
    • 2020-06-20
    相关资源
    最近更新 更多