添加、更新或删除扫描定义

适用于:

希望体验 Microsoft Defender for Endpoint? 注册免费试用版

想要体验 Microsoft Defender 漏洞管理? 详细了解如何注册 Microsoft Defender 漏洞管理公共预览版试用版

重要

本文中的某些信息与预发行的产品有关,该产品在商业发布之前可能有重大修改。 Microsoft 对此处所提供的信息不作任何明示或默示的保证。

注意

如果你是美国政府客户,请使用 适用于美国政府客户的 Microsoft Defender for Endpoint 中列出的 URI。

提示

为了提高性能,可以使用离地理位置更近的服务器:

  • us.api.security.microsoft.com
  • eu.api.security.microsoft.com
  • uk.api.security.microsoft.com
  • au.api.security.microsoft.com
  • swa.api.security.microsoft.com
  • ina.api.security.microsoft.com

API 说明

用于添加、更新或删除经过身份验证的扫描的 API。

限制

此 API 的速率限制是每分钟 100 个调用和每小时 1,500 个调用。

可以根据配置的保留期在上次出现的计算机上发布。

权限

要调用此 API,需要以下权限之一。 若要了解详细信息(包括如何选择权限),请参阅 使用 Defender for Endpoint API

权限类型 权限 权限显示名称
应用程序 Machine.ReadWrite.All 读取和写入所有扫描信息。
委派(工作或学校帐户) Machine.Read.Write 读取和写入所有扫描信息。

注意

使用用户凭据获取令牌时:

  • 若要查看数据,用户至少需要具有以下角色权限: ViewDataTvmViewData (有关详细信息,请参阅 创建和管理角色)
  • 若要编辑数据,用户至少需要具有以下角色权限: ManageSecurity (有关详细信息,请参阅 创建和管理角色)

HTTP 请求

POST https://api.securitycenter.microsoft.com/api/DeviceAuthenticatedScanDefinitions

请求标头

名称 类型 说明
Authorization String 持有者 {token}。 必需。
Content-Type string application/json. 必需。

请求正文

在请求正文中,提供具有以下参数的 JSON 对象:

参数 类型 说明
scanType 枚举 扫描的类型。 可能的值为:“Windows”、“Network”。 必需。
scanName String 扫描的名称。 必需。
isActive 布尔值 扫描是否主动运行的状态。 必需。
target String 要扫描的目标(IP 地址或主机名)的逗号分隔列表。 必需。
intervalInHours Int 扫描的运行间隔。 必需。
targetType String 目标字段中的目标类型。 可能的类型为“IP 地址”或“主机名”。 默认值为“IP 地址”。 必需。
scannerAgent Object 计算机 ID。 必需
scanAuthenticationParams Object 表示身份验证参数的对象,请参阅预期字段的 身份验证参数对象属性 。 此属性在创建新扫描时是必需的,在更新扫描时是可选的。

响应

如果成功,此方法在响应正文中返回 200 - 正常响应代码和新的或更新的扫描定义。

添加新扫描的示例请求

下面是添加新扫描的请求示例。

POST https://api.securitycenter.microsoft.com/api/DeviceAuthenticatedScanDefinitions
 {
"scanType": "Windows", 
"scanName": "Test Windows scan", 
"isActive": true, 
"target": "127.0.0.1", 
"intervalInHours": 1, 
"targetType": "Ip",
"scannerAgent": {
    "machineId": "eb663a27ae9d032f61bc268a79eedf14c4b90f77",
},
"scanAuthenticationParams": { 
    "@odata.type": "#microsoft.windowsDefenderATP.api.WindowsAuthParams", 
    "type": "Kerberos", 
    "username": "username", 
    "domain": "password",
    "isGmsaUser": true
    }
}

示例响应

以下是响应示例。

 {
"@odata.context": "https://api.securitycenter.microsoft.com/api/$metadata#DeviceAuthenticatedScanDefinitions/$entity",
    "id": "289224fb-1686-472c-9751-5555960854ca",
    "scanType": "Windows",
    "scanName": "Test Windows scan",
    "isActive": true,
    "target": "127.0.0.1",
    "orgId": "0335a792-18d2-424b-aeed-559567054570",
    "intervalInHours": 1,
    "createdBy": "username@test.com",
    "targetType": "Ip",
    "scanAuthenticationParams": null,
    "scannerAgent": {
        "id": "0335a792-18d2-424b-aeed-559567054570_ eb663a27ae9d032f61bc268a79eedf14c4b90f77",
        "machineId": "eb663a27ae9d032f61bc268a79eedf14c4b90f77",
        "machineName": "DESKTOP-TEST",
        "lastSeen": "2023-01-04T09:40:03.2787058Z",
        "assignedApplicationId": "ae4a5cde-b4a1-4b76-8635-458b2cf15752",
        "scannerSoftwareVersion": "7.6.0.0",
        "lastCommandExecutionTimestamp": "2023-01-04T09:33:16Z",
        "mdeClientVersion": "10.8295.22621.1010"
    },
    "latestScan": {
        "status": null,
        "failureReason": null,
        "executionDateTime": null
    }

}

更新扫描的示例请求

下面是更新扫描的请求示例。

PATCH  https://api.securitycenter.microsoft.com/api/DeviceAuthenticatedScanDefinitions/289224fb-1686-472c-9751-5555960854ca 
{
"scanName": "Test Update Windows scan", 
"isActive": false, 
"target": "127.0.0.2,127.0.0.3", 
"intervalInHours": 1, 
"targetType": "Ip",
"scanAuthenticationParams": { 
    "@odata.type": "#microsoft.windowsDefenderATP.api.WindowsAuthParams", 
    "type": "Kerberos", 
    "username": "username", 
    "domain": "password",
    "isGmsaUser": true
    }
 }

响应示例

以下是响应示例。

{
    "@odata.context": "https://localhost:1059/api/$metadata#DeviceAuthenticatedScanDefinitions/$entity",
    "id": "289224fb-1686-472c-9751-5555960854ca",
    "scanType": "Windows",
    "scanName": "Test Update Windows scan",
    "isActive": false,
    "target": "127.0.0.2,127.0.0.3",
    "orgId": "0335a792-18d2-424b-aeed-559567054570",
    "intervalInHours": 1,
    "createdBy": "userName@microsoft.com",
    "targetType": "Ip",
    "scanAuthenticationParams": null,
    "scannerAgent": {
        "id": "0335a792-18d2-424b-aeed-559567054570_eb663a27ae9d032f61bc268a79eedf14c4b90f77",
        "machineId": "eb663a27ae9d032f61bc268a79eedf14c4b90f77",
        "machineName": "DESKTOP-TEST",
        "lastSeen": "2023-01-04T09:40:03.2787058Z",
        "assignedApplicationId": "ae4a5cde-b4a1-4b76-8635-458b2cf15752",
        "scannerSoftwareVersion": "7.6.0.0",
        "lastCommandExecutionTimestamp": "2023-01-04T09:33:16Z",
        "mdeClientVersion": "10.8295.22621.1010"
    },
    "latestScan": {
        "status": null,
        "failureReason": null,
        "executionDateTime": null
    }
}

删除扫描的示例请求

下面是删除扫描的请求示例。

POST https://api.securitycenter.microsoft.com/api/DeviceAuthenticatedScanDefinitions/BatchDelete
{
  "ScanDefinitionIds": ["td32f17af-5cc2-4e4e-964a-4c4ef7d216e2", "ab32g20af-5dd2-4a5e-954a-4c4ef7d216e2"],
}

提示

想要了解更多信息? 在技术社区中与 Microsoft 安全社区互动: Microsoft Defender for Endpoint 技术社区