更新模拟

命名空间:microsoft.graph

重要

Microsoft Graph /beta 版本下的 API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。

更新租户的 攻击模拟活动 。 只能更新处于 draft 状态的模拟。

API 可用性

此 API 可用于以下国家级云部署。

全局服务 美国政府 L4 美国政府 L5 (DOD) 由世纪互联运营的中国
✅ ❌ ❌ ❌

权限

为此 API 选择标记为最低特权的权限。 只有在应用需要它时,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型。 要了解有关这些权限的详细信息,请参阅 权限参考。

权限类型 最低特权权限 更高特权权限
委派(工作或学校帐户) AttackSimulation.ReadWrite.All 不可用。
委派(个人 Microsoft 帐户) 不支持。 不支持。
应用程序 AttackSimulation.ReadWrite.All 不可用。

HTTP 请求

PATCH /security/attackSimulation/simulations/{simulationId}

请求标头

标头 值
Authorization 持有者 {token}。 必填。 详细了解 身份验证和授权。
Content-Type application/json

请求正文

在请求正文中, 仅 提供要更新的属性的值。 请求正文中未包含的现有属性会保留其以前的值,或者会根据其他属性值的更改重新计算。

下表指定可更新的属性。

属性 类型 说明
attackTechnique simulationAttackTechnique 攻击模拟和训练活动中使用的社会工程技术。 支持 $filter 和 $orderby。 可能的值为:unknown、、credentialHarvesting、。 driveByUrlphishTrainingattachmentMalwarelinkInAttachmentlinkToMalwareFileunknownFutureValueoAuthConsentGrant 使用 Prefer: include-unknown-enum-members 请求标头从这个 可进化的枚举中获取以下值: oAuthConsentGrant, phishTraining. 有关社交工程攻击技术类型的详细信息,请参阅 模拟。
attackType simulationAttackType 攻击模拟和训练活动的攻击类型。 可能的值包括 unknown、social、cloud、endpoint、unknownFutureValue。
displayName String 显示攻击模拟和训练市场活动的名称。 支持 $filter 和 $orderby。
durationInDays Int32 模拟持续时间(以天为单位)。
excludedAccountTarget accountTargetContent 模拟中排除的用户。
includedAccountTarget accountTargetContent 模拟中的目标用户。
payload 有效负载 与模拟关联的有效负载。 必填。
status simulationStatus 攻击模拟和训练活动的状态。 可能的值为:unknown、、draft、。 scheduledunknownFutureValuerunningsucceededfailedcancelledexcluded

响应

此方法返回响应 202 Accepted 代码和跟踪标头 location (应轮询该代码以确定操作的结果)。

示例

示例 1:更新攻击模拟市场活动

以下示例演示如何更新租户的攻击模拟活动。

请求

以下示例显示了一个请求。

PATCH https://graph.microsoft.com/beta/security/attackSimulation/simulations/2f5548d1-0dd8-4cc8-9de0-e0d6ec7ea3dc
Content-type: application/json

{
  "@odata.etag": "\"0100aa9b-0000-0100-0000-6396fa270000\"",
  "displayName": "Graph Simulation",
  "payload@odata.bind":"https://graph.microsoft.com/beta/security/attacksimulation/payloads/12345678-9abc-def0-123456789a",
  "durationInDays": 7,
  "attackTechnique": "credentialHarvesting",
  "attackType": "social",
  "status": "scheduled",
  "includedAccountTarget": {
    "@odata.type": "#microsoft.graph.addressBookAccountTargetContent",
    "type" : "addressBook",
    "accountTargetEmails" : [
        "faiza@contoso.com"
    ]
  },
  "excludedAccountTarget": {
    "@odata.type": "#microsoft.graph.addressBookAccountTargetContent",
    "type" : "addressBook",
    "accountTargetEmails" : [
        "sam@contoso.com"
    ]
  }
}

响应

以下示例显示了相应的响应。

HTTP/1.1 202 Accepted

示例 2:将攻击模拟市场活动从草稿更新为计划

以下示例演示如何计划攻击模拟活动。 计划模拟时验证模拟请求。 所有必需的参数都需要在此类请求中传播。

请求

以下示例显示了一个请求。

PATCH https://graph.microsoft.com/beta/security/attackSimulation/simulations/2f5548d1-0dd8-4cc8-9de0-e0d6ec7ea3dc
Content-type: application/json

{
  "@odata.etag": "\"0100aa9b-0000-0100-0000-6396fa270000\"",
  "id": "2f5548d1-0dd8-4cc8-9de0-e0d6ec7ea3dc",
  "displayName": "Graph Simulation",
  "payload@odata.bind":"https://graph.microsoft.com/beta/security/attacksimulation/payloads/12345678-9abc-def0-123456789a",
  "durationInDays": 7,
  "attackTechnique": "credentialHarvesting",
  "attackType": "social",
  "status": "scheduled",
  "includedAccountTarget": {
    "@odata.type": "#microsoft.graph.addressBookAccountTargetContent",
    "type" : "addressBook",
    "accountTargetEmails" : [
        "faiza@contoso.com"
    ]
  },
  "excludedAccountTarget": {
    "@odata.type": "#microsoft.graph.addressBookAccountTargetContent",
    "type" : "addressBook",
    "accountTargetEmails" : [
        "sam@contoso.com"
    ]
  }
}

响应

以下示例显示了相应的响应。

HTTP/1.1 202 Accepted

示例 3:取消攻击模拟活动

以下示例演示如何取消租户的攻击模拟活动。 当模拟的状态为 scheduled 或 running时,可取消模拟。

请求

以下示例显示了一个请求。

PATCH https://graph.microsoft.com/beta/security/attackSimulation/simulations/2f5548d1-0dd8-4cc8-9de0-e0d6ec7ea3dc
Content-type: application/json

{
  "@odata.etag": "\"0100aa9b-0000-0100-0000-6396fa270000\"",
  "id": "2f5548d1-0dd8-4cc8-9de0-e0d6ec7ea3dc",
  "status": "cancelled"
}

响应

以下示例显示了相应的响应。

HTTP/1.1 202 Accepted

示例 4:排除攻击模拟活动

以下示例显示了如何排除租户的攻击模拟活动。 只有当模拟的状态 cancelled为 .

请求

以下示例显示了一个请求。

PATCH https://graph.microsoft.com/beta/security/attackSimulation/simulations/2f5548d1-0dd8-4cc8-9de0-e0d6ec7ea3dc
Content-type: application/json

{
  "@odata.etag": "\"0100aa9b-0000-0100-0000-6396fa270000\"",
  "id": "2f5548d1-0dd8-4cc8-9de0-e0d6ec7ea3dc",
  "status": "excluded"
}

响应

以下示例显示了相应的响应。

HTTP/1.1 202 Accepted