I need to get info about changes made on Directory roles (for example Global Administrator) I need details like, username - A) user who made a change, B) timestamp, C) action - add a user to a group or remove, D) name of the group to which user has been added. I updated AD module on Azure portal, now I have AzureADPreview, and I am using cmd-let --> Get-AzureADAuditDirectoryLogs
. And as an output I can get only: A) B) and C). I checked all "Id" from the output but I didn't find Directory Roles IDs. Is there a method for catching this info --> (D) using mentioned PowerShell command? below, the command I used:
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"
UPDATE:
I used Rest API in order to catch the needed information:
$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
And in the output still, don't see info about the group to which the user has been added.