Get AzureADAuditDirectoryLogs查找更新了AzureADAuditDirectoryLogs电话号码的用户

Get AzureADAuditDirectoryLogs查找更新了AzureADAuditDirectoryLogs电话号码的用户,azure,azure-active-directory,Azure,Azure Active Directory,我需要找到在AzureAd上更改电话号码的所有用户。我希望我能找到关于Get AzureadauditDictoryLogs的信息,但我什么也找不到 Get-AzureADAuditDirectoryLogs -All $true -Filter "activityDateTime le 2019-12-18 and Category eq 'UserManagement' and OperationType eq 'Update' and ActivityDisplayName eq 'Upd

我需要找到在AzureAd上更改电话号码的所有用户。我希望我能找到关于Get AzureadauditDictoryLogs的信息,但我什么也找不到

Get-AzureADAuditDirectoryLogs -All $true -Filter "activityDateTime le 2019-12-18 and Category eq 'UserManagement' and OperationType eq 'Update' and ActivityDisplayName eq 'Update user'" 

我的问题是。当用户在其帐户上添加或更新字段时,我可以在何处以及如何查找?

根据我的测试,您的命令应该可以工作

Get-AzureADAuditDirectoryLogs -All $true -Filter "activityDateTime le 2020-01-04 and Category eq 'UserManagement' and OperationType eq 'Update' and ActivityDisplayName eq 'Update user'"
但是我什么也找不到

我可以找到的原因可能是activityDateTime le 2019-12-18,le表示小于或等于,因此最大值为2019-12-18 00:00:00,如果活动发生在2019-12-18 01:17:12,则不会在结果中返回,您需要使用activityDateTime le 2019-12-19

更新:

如果要将新电话号码导出到csv文件,请尝试下面的脚本

注意:当使用上面的查询时,它还将包括其他用户更新信息,如职位、部门等。因此我们需要在脚本中排除它们,Azure AD用户属性中有Office PhonePhoneNumber和Mobile phoneMobile,在我的示例中,它们都包括在内。如果脚本中的$log.TargetResources.ModifiedProperties.NewValue[1].Trim,-eq'Mobile'-或$log.TargetResources.ModifiedProperties.NewValue[1].Trim,-eq'TelephoneNumber',也可以修改此行,以满足您自己的要求

csv文件如下所示,包括UserPrincipalName及其新电话号码


从这里我可以在哪里找到新的电话号码?我需要将新电话号码导出到CSV@Vel周一我会为你更新,现在我不在办公室。:-这太好了,谢谢。这可能不太可能,但我们也在使用自定义扩展字段。我似乎找不到它的任何更新。您能告诉我如何提取这些自定义字段上的更改吗?@Vel我的方法是更新要跟踪测试用户的信息,然后查看TargetResources.ModifiedProperties,我们会找到更新的信息。有一些字符[],然后我们使用Trim来排除它们。
$users = @()
$logs = Get-AzureADAuditDirectoryLogs -All $true -Filter "activityDateTime le 2020-01-07 and Category eq 'UserManagement' and OperationType eq 'Update' and ActivityDisplayName eq 'Update user'"
foreach($log in $logs){
    if($log.TargetResources.ModifiedProperties.NewValue[1].Trim(""",""") -eq 'Mobile' -or $log.TargetResources.ModifiedProperties.NewValue[1].Trim(""",""") -eq 'TelephoneNumber'){
            $obj = [PSCustomObject]@{
            UserPrincipalName = $log.TargetResources.UserPrincipalName
            Phone = $log.TargetResources.ModifiedProperties.NewValue[0].Trim("["",""]")
            }
        $users += $obj
    }
}
$users | Export-Csv -Path C:\Users\joyw\Desktop\phone.csv -NoTypeInformation