azure - Azure 身份保护 - 风险检测 API - 按日期筛选
问题描述
我正在尝试按日期过滤从 Azure Identity Protection 检索到的 RiskDetection 数据,但到目前为止没有成功。
对于以下按activityDateTime(或示例数据中的任何日期字段)过滤的示例数据,在响应中显示内部错误:
https://graph.microsoft.com/beta/riskDetections ?$filter=activityDateTime ge 2020-02-05
{'error': {'code': 'Internal Server Error', 'message': 'There was an internal
server error while processing the request.
Error ID: 0c2de841-9d83-479a-b7f2-ed2c102908f6',
'innerError':
{'request-id': '0c2de841-9d83-479a-b7f2-ed2c102908f6',
'date': '2020-02-07T01:28:17'}}}
来自https://docs.microsoft.com/en-us/graph/query-parameters
注意:Azure AD 资源不支持以下 $filter 运算符:ne、gt、ge、lt、le 和 not。任何 Microsoft Graph 资源当前不支持包含字符串运算符。
有没有办法按日期过滤 RiskDetections?将不胜感激任何帮助。
以下带有 riskType 和 riskLevel 的过滤器显示数据:
risk_detections_api_url = " https://graph.microsoft.com/beta/riskDetections ?$filter=riskType eq 'anonymizedIPAddress' 或 riskLevel eq 'medium'"
下面带有 userPrincipalName 的过滤器显示数据:
risk_detections_api_url = " https://graph.microsoft.com/beta/riskDetections ?$filter=userPrincipalName eq 'john.doe@example.com'"
下面带有 ipAddress 的过滤器显示数据:
risk_detections_api_url = " https://graph.microsoft.com/beta/riskDetections ?$filter=ipAddress eq '195.228.45.176'"
样本数据
{
"id": "8901d1fee9bqwqweqwe683a221af3d2ae691736f2e369e0dd530625398",
"requestId": "cc755f41-0313-4cb2-96ce-3a6283fef200",
"correlationId": "c422083d-0e32-4afb-af4e-6ca46e4235b4",
"riskType": "anonymizedIPAddress",
"riskState": "atRisk",
"riskLevel": "medium",
"riskDetail": "none",
"source": "IdentityProtection",
"detectionTimingType": "realtime",
"activity": "signin",
"tokenIssuerType": "AzureAD",
"ipAddress": "195.228.45.176",
"activityDateTime": "2019-12-26T17:40:02.1402381Z",
"detectedDateTime": "2019-12-26T17:40:02.1402381Z",
"lastUpdatedDateTime": "2019-12-26T17:43:21.8931807Z",
"userId": "e3835755-80b0-4b61-a1c0-5ea9ead75300",
"userDisplayName": "John Doe",
"userPrincipalName": "john.doe@example.com",
"additionalInfo": "[{\"Key\":\"userAgent\",\"Value\":\"Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Firefox/68.0\"}]",
"location": {
"city": "Budapest",
"state": "Budapest",
"countryOrRegion": "HU",
"geoCoordinates": {
"latitude": 47.45996,
"longitude": 19.14968
}
}
}
解决方案
基于Properties,activityDateTime
是datetimeoffset
类型。
所以你应该使用GET https://graph.microsoft.com/beta/riskDetections?$filter=activityDateTime gt 2019-12-25
而不是GET https://graph.microsoft.com/beta/riskDetections?$filter=activityDateTime gt '2019-12-25'
.
这里有一个类似的 API 文档:List directoryAudits。
但是当我测试它时,它给出了 500 错误:
{
"error": {
"code": "Internal Server Error",
"message": "There was an internal server error while processing the request. Error ID: d52436f6-073b-4fc8-b3bc-c6a6336d6886",
"innerError": {
"request-id": "d52436f6-073b-4fc8-b3bc-c6a6336d6886",
"date": "2020-02-05T04:10:45"
}
}
}
我相信这个 API 的 beta 版本仍然在变化。您可以使用您的请求 ID 联系 Microsoft 支持以进行进一步调查。
推荐阅读
- java - 是什么导致此代码无法正确编译
- javascript - 赛普拉斯中“watchPosition”的存根
- c# - C# ASP.NET Core [Inject] 依赖注入的属性用法
- javascript - React useState 2D 数组的问题
- react-native - 包含在屏幕反应原生中的模态
- javascript - 在 aws lambda 中运行时加密验证签名失败
- python-3.x - 如何在python中链接几个散景/全息视图/面板对象的悬停?
- python - 线程 0 在使用 C 库和 Python 时崩溃
- angular - 在单个 Ionic + Angular 项目中的两个 ionic 应用程序之间导航
- python - 在 Dataframe 上将 STR 转换为 INT 不适用于特定部分