你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Experiments - Create Or Update

创建或更新试验资源。

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}?api-version=2024-01-01

URI 参数

名称 必需 类型 说明
experimentName
path True

string

表示试验资源名称的字符串。

Regex pattern: ^[^<>%&:?#/\\]+$

resourceGroupName
path True

string

表示 Azure 资源组的字符串。

Regex pattern: ^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$

subscriptionId
path True

string

表示 Azure 订阅 ID 的 GUID。

Regex pattern: ^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$

api-version
query True

string

设置 API 版本的字符串。

Regex pattern: ^[0-9]{4}-[0-9]{2}-[0-9]{2}(|-preview)$

请求正文

名称 必需 类型 说明
location True

string

资源所在的地理位置

properties.selectors True selector[]:

选择器列表。

properties.steps True

step[]

步骤列表。

identity

resourceIdentity

试验资源的标识。

tags

object

资源标记。

响应

名称 类型 说明
200 OK

experiment

长时间运行的替换试验操作。

201 Created

experiment

长时间运行的创建试验操作。

Other Status Codes

ErrorResponse

如果请求失败,则返回错误响应。

安全性

azure_auth

Azure Active Directory OAuth2 流

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

名称 说明
user_impersonation 模拟用户帐户

示例

Create/update a Experiment in a resource group.

Sample Request

PUT https://management.azure.com/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment?api-version=2024-01-01

{
  "location": "eastus2euap",
  "identity": {
    "type": "SystemAssigned"
  },
  "properties": {
    "steps": [
      {
        "name": "step1",
        "branches": [
          {
            "name": "branch1",
            "actions": [
              {
                "type": "continuous",
                "name": "urn:csci:microsoft:virtualMachine:shutdown/1.0",
                "selectorId": "selector1",
                "duration": "PT10M",
                "parameters": [
                  {
                    "key": "abruptShutdown",
                    "value": "false"
                  }
                ]
              }
            ]
          }
        ]
      }
    ],
    "selectors": [
      {
        "type": "List",
        "id": "selector1",
        "targets": [
          {
            "type": "ChaosTarget",
            "id": "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"
          }
        ]
      }
    ]
  }
}

Sample Response

Azure-AsyncOperation: https://management.azure.com/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/myResourceGroup/providers/Microsoft.Chaos/locations/eastus/operationStatus/00000000-0000-0000-0000-000000000000?api-version=2024-01-01
Location: https://management.azure.com/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/myResourceGroup/providers/Microsoft.Chaos/experiments/00000000-0000-0000-0000-000000000000?api-version=2024-01-01
{
  "id": "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment",
  "type": "Microsoft.Chaos/experiments",
  "name": "exampleExperiment",
  "location": "eastus2euap",
  "identity": {
    "type": "SystemAssigned",
    "principalId": "d04ab567-2c07-43ef-a7f4-4527626b7f56",
    "tenantId": "8c3e2fb2-fe7a-4bf1-b779-d73990782fe6"
  },
  "properties": {
    "provisioningState": "Creating",
    "steps": [
      {
        "name": "step1",
        "branches": [
          {
            "name": "branch1",
            "actions": [
              {
                "type": "continuous",
                "name": "urn:csci:microsoft:virtualMachine:shutdown/1.0",
                "selectorId": "selector1",
                "duration": "PT10M",
                "parameters": [
                  {
                    "key": "abruptShutdown",
                    "value": "false"
                  }
                ]
              }
            ]
          }
        ]
      }
    ],
    "selectors": [
      {
        "type": "List",
        "id": "selector1",
        "targets": [
          {
            "type": "ChaosTarget",
            "id": "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"
          }
        ]
      }
    ]
  },
  "systemData": {
    "createdAt": "2021-07-01T00:00:00.0Z",
    "createdBy": "User",
    "createdByType": "b3a41dba-4415-4d36-9ee8-e5eaa86db976",
    "lastModifiedAt": "2021-07-01T00:00:00.0Z",
    "lastModifiedBy": "User",
    "lastModifiedByType": "b3a41dba-4415-4d36-9ee8-e5eaa86db976"
  }
}
Azure-AsyncOperation: https://management.azure.com/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/myResourceGroup/providers/Microsoft.Chaos/locations/eastus/operationStatus/00000000-0000-0000-0000-000000000000?api-version=2024-01-01
Location: https://management.azure.com/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/myResourceGroup/providers/Microsoft.Chaos/experiments/00000000-0000-0000-0000-000000000000?api-version=2024-01-01
{
  "id": "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment",
  "type": "Microsoft.Chaos/experiments",
  "name": "exampleExperiment",
  "location": "eastus2euap",
  "identity": {
    "type": "SystemAssigned",
    "principalId": "d04ab567-2c07-43ef-a7f4-4527626b7f56",
    "tenantId": "8c3e2fb2-fe7a-4bf1-b779-d73990782fe6"
  },
  "properties": {
    "provisioningState": "Updating",
    "steps": [
      {
        "name": "step1",
        "branches": [
          {
            "name": "branch1",
            "actions": [
              {
                "type": "continuous",
                "name": "urn:csci:microsoft:virtualMachine:shutdown/1.0",
                "selectorId": "selector1",
                "duration": "PT10M",
                "parameters": [
                  {
                    "key": "abruptShutdown",
                    "value": "false"
                  }
                ]
              }
            ]
          }
        ]
      }
    ],
    "selectors": [
      {
        "type": "List",
        "id": "selector1",
        "targets": [
          {
            "type": "ChaosTarget",
            "id": "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"
          }
        ]
      }
    ]
  },
  "systemData": {
    "createdAt": "2021-07-01T00:00:00.0Z",
    "createdBy": "User",
    "createdByType": "b3a41dba-4415-4d36-9ee8-e5eaa86db976",
    "lastModifiedAt": "2021-07-01T00:00:00.0Z",
    "lastModifiedBy": "User",
    "lastModifiedByType": "b3a41dba-4415-4d36-9ee8-e5eaa86db976"
  }
}

定义

名称 说明
branch

表示步骤中分支的模型。 每个实验总共 9 个。

continuousAction

表示连续操作的模型。

createdByType

创建资源的标识类型。

delayAction

表示延迟操作的模型。

discreteAction

表示离散操作的模型。

ErrorAdditionalInfo

资源管理错误附加信息。

ErrorDetail

错误详细信息。

ErrorResponse

错误响应

experiment

表示试验资源的模型。

keyValuePair

描述操作设置的映射。

listSelector

表示列表选择器的模型。

ProvisioningState

给定试验资源的最新预配状态。

querySelector

表示查询选择器的模型。

resourceIdentity

资源的标识。

ResourceIdentityType

资源标识类型的字符串。

simpleFilter

表示简单目标筛选器的模型。

simpleFilterParameters

表示简单筛选器参数的模型。

step

表示试验资源中的步骤的模型。

systemData

与资源的创建和上次修改相关的元数据。

targetReference

表示对选择器中 Target 的引用的模型。

TargetReferenceType

目标引用类型的枚举。

UserAssignedIdentity

用户分配的标识属性

branch

表示步骤中分支的模型。 每个实验总共 9 个。

名称 类型 说明
actions action[]:

操作列表。

name

string

分支名称的字符串。

continuousAction

表示连续操作的模型。

名称 类型 说明
duration

string

ISO8601表示持续时间的带格式字符串。

name

string

表示功能 URN 的字符串。

parameters

keyValuePair[]

键值对的列表。

selectorId

string

表示选择器的字符串。

type string:

continuous

区分操作模型之间的枚举。

createdByType

创建资源的标识类型。

名称 类型 说明
Application

string

Key

string

ManagedIdentity

string

User

string

delayAction

表示延迟操作的模型。

名称 类型 说明
duration

string

ISO8601表示持续时间的带格式字符串。

name

string

表示功能 URN 的字符串。

type string:

delay

区分操作模型之间的枚举。

discreteAction

表示离散操作的模型。

名称 类型 说明
name

string

表示功能 URN 的字符串。

parameters

keyValuePair[]

键值对的列表。

selectorId

string

表示选择器的字符串。

type string:

discrete

区分操作模型之间的枚举。

ErrorAdditionalInfo

资源管理错误附加信息。

名称 类型 说明
info

object

其他信息。

type

string

其他信息类型。

ErrorDetail

错误详细信息。

名称 类型 说明
additionalInfo

ErrorAdditionalInfo[]

错误附加信息。

code

string

错误代码。

details

ErrorDetail[]

错误详细信息。

message

string

错误消息。

target

string

错误目标。

ErrorResponse

错误响应

名称 类型 说明
error

ErrorDetail

错误对象。

experiment

表示试验资源的模型。

名称 类型 说明
id

string

资源的完全限定的资源 ID。 例如 - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

identity

resourceIdentity

试验资源的标识。

location

string

资源所在的地理位置

name

string

资源的名称

properties.provisioningState

ProvisioningState

给定试验资源的最新预配状态。

properties.selectors selector[]:

选择器列表。

properties.steps

step[]

步骤列表。

systemData

systemData

试验资源的系统元数据。

tags

object

资源标记。

type

string

资源类型。 例如“Microsoft.Compute/virtualMachines”或“Microsoft.Storage/storageAccounts”

keyValuePair

描述操作设置的映射。

名称 类型 说明
key

string

操作的设置的名称。

value

string

操作设置的值。

listSelector

表示列表选择器的模型。

名称 类型 说明
filter filter:

simpleFilter

表示可应用于目标列表的可用筛选器类型的模型。

id

string

选择器 ID 的字符串。

targets

targetReference[]

目标引用列表。

type string:

List

选择器类型的枚举。

ProvisioningState

给定试验资源的最新预配状态。

名称 类型 说明
Canceled

string

Creating

string

Deleting

string

Failed

string

Succeeded

string

Updating

string

querySelector

表示查询选择器的模型。

名称 类型 说明
filter filter:

simpleFilter

表示可应用于目标列表的可用筛选器类型的模型。

id

string

选择器 ID 的字符串。

queryString

string

针对目标资源的 Azure Resource Graph (ARG) 查询语言查询。

subscriptionIds

string[]

用于确定资源查询范围的订阅 ID 列表。

type string:

Query

选择器类型的枚举。

resourceIdentity

资源的标识。

名称 类型 说明
principalId

string

表示此资源标识的主体 ID 的 GUID。

tenantId

string

表示此资源标识的租户 ID 的 GUID。

type

ResourceIdentityType

资源标识类型的字符串。

userAssignedIdentities

<string,  UserAssignedIdentity>

User-Assigned 标识
与试验关联的用户标识列表。 用户标识字典键引用将是 ARM 资源 ID,格式为:“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}”。

ResourceIdentityType

资源标识类型的字符串。

名称 类型 说明
None

string

SystemAssigned

string

UserAssigned

string

simpleFilter

表示简单目标筛选器的模型。

名称 类型 说明
parameters

simpleFilterParameters

表示简单筛选器参数的模型。

type string:

Simple

区分筛选器类型的枚举。 目前仅 Simple 支持类型。

simpleFilterParameters

表示简单筛选器参数的模型。

名称 类型 说明
zones

string[]

要按其筛选目标的 Azure 可用性区域列表。

step

表示试验资源中的步骤的模型。

名称 类型 说明
branches

branch[]

分支列表。

name

string

步骤名称的字符串。

systemData

与资源的创建和上次修改相关的元数据。

名称 类型 说明
createdAt

string

资源创建时间戳 (UTC) 。

createdBy

string

创建资源的标识。

createdByType

createdByType

创建资源的标识类型。

lastModifiedAt

string

资源上次修改的时间戳 (UTC)

lastModifiedBy

string

上次修改资源的标识。

lastModifiedByType

createdByType

上次修改资源的标识类型。

targetReference

表示对选择器中 Target 的引用的模型。

名称 类型 说明
id

string

目标资源的资源 ID 的字符串。

type

TargetReferenceType

目标引用类型的枚举。

TargetReferenceType

目标引用类型的枚举。

名称 类型 说明
ChaosTarget

string

UserAssignedIdentity

用户分配的标识属性

名称 类型 说明
clientId

string

已分配标识的客户端 ID。

principalId

string

分配的标识的主体 ID。