Experiments - Create Or Update

建立或更新實驗資源。

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

URI 參數

名稱 位於 必要 類型 Description
experimentName
path True

string

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

代表實驗資源名稱的字串。

resourceGroupName
path True

string

minLength: 1
maxLength: 90

資源群組的名稱。 名稱不區分大小寫。

subscriptionId
path True

string (uuid)

目標訂用帳戶的標識碼。 此值必須是 UUID。

api-version
query True

string

minLength: 1

用於此作業的 API 版本。

要求本文

名稱 必要 類型 Description
location True

string

資源所在的地理位置

properties.selectors True ChaosTargetSelector[]:

選取器清單。

properties.steps True

ChaosExperimentStep[]

步驟清單。

identity

ManagedServiceIdentity

指派給此資源的受控服務識別。

properties.customerDataStorage

CustomerDataStorageProperties

將儲存實驗架構的選擇性客戶自控記憶體帳戶。

tags

object

資源標籤。

回覆

名稱 類型 Description
200 OK

Experiment

資源 『Experiment』 更新作業成功

201 Created

Experiment

資源 『Experiment』 建立作業成功

標題

  • Azure-AsyncOperation: string
  • Retry-After: integer
Other Status Codes

ErrorResponse

未預期的錯誤回應。

安全性

azure_auth

Azure Active Directory OAuth2 Flow。

類型: oauth2
Flow: implicit
授權 URL: https://login.microsoftonline.com/common/oauth2/authorize

範圍

名稱 Description
user_impersonation 冒用您的使用者帳戶

範例

Create/update a Experiment in a resource group.

範例要求

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

{
  "identity": {
    "type": "SystemAssigned"
  },
  "tags": {
    "key7131": "ryohwcoiccwsnewjigfmijz",
    "key2138": "fjaeecgnvqd"
  },
  "location": "eastus2euap",
  "properties": {
    "customerDataStorage": {
      "blobContainerName": "azurechaosstudioexperiments",
      "storageAccountResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/exampleRG/providers/Microsoft.Storage/storageAccounts/exampleStorage"
    },
    "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"
          }
        ]
      }
    ],
    "steps": [
      {
        "name": "step1",
        "branches": [
          {
            "name": "branch1",
            "actions": [
              {
                "name": "urn:csci:microsoft:virtualMachine:shutdown/1.0",
                "type": "continuous",
                "duration": "PT10M",
                "parameters": [
                  {
                    "key": "abruptShutdown",
                    "value": "false"
                  }
                ],
                "selectorId": "selector1"
              }
            ]
          }
        ]
      }
    ]
  }
}

範例回覆

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=2026-11-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=2026-11-01
{
  "name": "exampleExperiment",
  "type": "Microsoft.Chaos/experiments",
  "id": "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment",
  "identity": {
    "type": "SystemAssigned",
    "principalId": "d04ab567-2c07-43ef-a7f4-4527626b7f56",
    "tenantId": "8c3e2fb2-fe7a-4bf1-b779-d73990782fe6"
  },
  "tags": {
    "key7131": "ryohwcoiccwsnewjigfmijz",
    "key2138": "fjaeecgnvqd"
  },
  "location": "eastus2euap",
  "properties": {
    "customerDataStorage": {
      "blobContainerName": "azurechaosstudioexperiments",
      "storageAccountResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/exampleRG/providers/Microsoft.Storage/storageAccounts/exampleStorage"
    },
    "provisioningState": "Updating",
    "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"
          }
        ]
      }
    ],
    "steps": [
      {
        "name": "step1",
        "branches": [
          {
            "name": "branch1",
            "actions": [
              {
                "name": "urn:csci:microsoft:virtualMachine:shutdown/1.0",
                "type": "continuous",
                "duration": "PT10M",
                "parameters": [
                  {
                    "key": "abruptShutdown",
                    "value": "false"
                  }
                ],
                "selectorId": "selector1"
              }
            ]
          }
        ]
      }
    ]
  },
  "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=2026-11-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=2026-11-01
{
  "name": "exampleExperiment",
  "type": "Microsoft.Chaos/experiments",
  "id": "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment",
  "identity": {
    "type": "SystemAssigned",
    "principalId": "d04ab567-2c07-43ef-a7f4-4527626b7f56",
    "tenantId": "8c3e2fb2-fe7a-4bf1-b779-d73990782fe6"
  },
  "tags": {
    "key7131": "ryohwcoiccwsnewjigfmijz",
    "key2138": "fjaeecgnvqd"
  },
  "location": "eastus2euap",
  "properties": {
    "customerDataStorage": {
      "blobContainerName": "azurechaosstudioexperiments",
      "storageAccountResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/exampleRG/providers/Microsoft.Storage/storageAccounts/exampleStorage"
    },
    "provisioningState": "Creating",
    "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"
          }
        ]
      }
    ],
    "steps": [
      {
        "name": "step1",
        "branches": [
          {
            "name": "branch1",
            "actions": [
              {
                "name": "urn:csci:microsoft:virtualMachine:shutdown/1.0",
                "type": "continuous",
                "duration": "PT10M",
                "parameters": [
                  {
                    "key": "abruptShutdown",
                    "value": "false"
                  }
                ],
                "selectorId": "selector1"
              }
            ]
          }
        ]
      }
    ]
  },
  "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"
  }
}

定義

名稱 Description
ChaosExperimentBranch

表示步驟中分支的模型。 每個實驗總共9個。

ChaosExperimentStep

代表實驗資源中步驟的模型。

ChaosTargetListSelector

代表清單選取器的模型。

ChaosTargetQuerySelector

代表查詢選取器的模型。

ChaosTargetSimpleFilter

代表簡單目標篩選的模型。

ChaosTargetSimpleFilterParameters

代表簡單篩選參數的模型。

ContinuousAction

表示連續動作的模型。

createdByType

建立此資源的身分識別類型。

CustomerDataStorageProperties

代表實驗中客戶管理儲存的模型。

DelayAction

表示延遲動作的模型。

DiscreteAction

表示離散動作的模型。

ErrorAdditionalInfo

資源管理錯誤其他資訊。

ErrorDetail

錯誤詳細資料。

ErrorResponse

錯誤回應

Experiment

代表實驗資源的模型。

ExperimentActionType

混沌實驗行動類型的枚舉聯合。

FilterType

區分篩選類型的列舉。 目前僅支援 Simple 類型。

KeyValuePair

一對鍵值對,用於描述動作或配置的參數。

ManagedServiceIdentity

受控服務識別(系統指派和/或使用者指派的身分識別)

ManagedServiceIdentityType

受控服務識別的類型(允許 SystemAssigned 和 UserAssigned 類型)。

ProvisioningState

目前某個 Azure Chaos 資源的配置狀態。

SelectorType

選取器類型的列舉。

systemData

與建立和上次修改資源相關的元數據。

TargetReference

代表選取器中目標參考的模型。

TargetReferenceType

目標參考類型的列舉。

UserAssignedIdentity

使用者指派的身分識別屬性

ChaosExperimentBranch

表示步驟中分支的模型。 每個實驗總共9個。

名稱 類型 Description
actions ChaosExperimentAction[]:

動作清單。

name

string

minLength: 1

分支名稱的字串。

ChaosExperimentStep

代表實驗資源中步驟的模型。

名稱 類型 Description
branches

ChaosExperimentBranch[]

分支清單。

name

string

minLength: 1

步驟名稱的字串。

ChaosTargetListSelector

代表清單選取器的模型。

名稱 類型 Description
filter ChaosTargetFilter:

ChaosTargetSimpleFilter

模型,表示可套用至目標清單的可用篩選類型。

id

string

minLength: 1

選取器識別碼的字串。

targets

TargetReference[]

目標參考清單。

type string:

List

混亂目標選取器歧視性類型

ChaosTargetQuerySelector

代表查詢選取器的模型。

名稱 類型 Description
filter ChaosTargetFilter:

ChaosTargetSimpleFilter

模型,表示可套用至目標清單的可用篩選類型。

id

string

minLength: 1

選取器識別碼的字串。

queryString

string

Azure Resource Graph (ARG) 查詢語言 針對目標資源的查詢。

subscriptionIds

string[]

範圍資源查詢的訂用帳戶標識碼清單。

type string:

Query

混亂目標選取器歧視性類型

ChaosTargetSimpleFilter

代表簡單目標篩選的模型。

名稱 類型 Description
parameters

ChaosTargetSimpleFilterParameters

代表簡單篩選參數的模型。

type string:

Simple

Chaos 目標篩選歧視性類型

ChaosTargetSimpleFilterParameters

代表簡單篩選參數的模型。

名稱 類型 Description
zones

string[]

Azure 可用性區域列表,可依篩選目標。

ContinuousAction

表示連續動作的模型。

名稱 類型 Description
duration

string (duration)

ISO8601表示持續時間的格式化字串。

name

string

maxLength: 2048

表示功能 URN 的字串。

parameters

KeyValuePair[]

索引鍵值組的清單。

selectorId

string

minLength: 1

表示選取器的字串。

type string:

continuous

混亂實驗動作歧視性類型

createdByType

建立此資源的身分識別類型。

值 Description
User
Application
ManagedIdentity
Key

CustomerDataStorageProperties

代表實驗中客戶管理儲存的模型。

名稱 類型 Description
blobContainerName

string

minLength: 3
maxLength: 63
pattern: ^[a-z0-9]([a-z0-9]|(-(?!-))){1,61}[a-z0-9]$

使用 Azure Blob 儲存體 容器名稱或建立。

storageAccountResourceId

string (arm-id)

使用 Azure 資源 ID 來儲存客戶資料的儲存帳號。

DelayAction

表示延遲動作的模型。

名稱 類型 Description
duration

string (duration)

ISO8601表示持續時間的格式化字串。

name

string

maxLength: 2048

表示功能 URN 的字串。

type string:

delay

混亂實驗動作歧視性類型

DiscreteAction

表示離散動作的模型。

名稱 類型 Description
name

string

maxLength: 2048

表示功能 URN 的字串。

parameters

KeyValuePair[]

索引鍵值組的清單。

selectorId

string

minLength: 1

表示選取器的字串。

type string:

discrete

混亂實驗動作歧視性類型

ErrorAdditionalInfo

資源管理錯誤其他資訊。

名稱 類型 Description
info

object

其他資訊。

type

string

其他信息類型。

ErrorDetail

錯誤詳細資料。

名稱 類型 Description
additionalInfo

ErrorAdditionalInfo[]

錯誤的其他資訊。

code

string

錯誤碼。

details

ErrorDetail[]

錯誤詳情

message

string

錯誤訊息。

target

string

錯誤目標。

ErrorResponse

錯誤回應

名稱 類型 Description
error

ErrorDetail

error 物件。

Experiment

代表實驗資源的模型。

名稱 類型 Description
id

string (arm-id)

資源的完整資源標識碼。 例如,“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}”

identity

ManagedServiceIdentity

指派給此資源的受控服務識別。

location

string

資源所在的地理位置

name

string

資源的名稱

properties.customerDataStorage

CustomerDataStorageProperties

將儲存實驗架構的選擇性客戶自控記憶體帳戶。

properties.provisioningState

ProvisioningState

指定實驗資源的最新布建狀態。

properties.selectors ChaosTargetSelector[]:

選取器清單。

properties.steps

ChaosExperimentStep[]

步驟清單。

systemData

systemData

包含 createdBy 和 modifiedBy 資訊的 Azure Resource Manager 元數據。

tags

object

資源標籤。

type

string

資源的類型。 例如:「Microsoft.Compute/virtualMachines」或「Microsoft.Storage/storageAccounts」

ExperimentActionType

混沌實驗行動類型的枚舉聯合。

值 Description
delay
discrete
continuous

FilterType

區分篩選類型的列舉。 目前僅支援 Simple 類型。

值 Description
Simple

簡單篩選類型。

KeyValuePair

一對鍵值對,用於描述動作或配置的參數。

名稱 類型 Description
key

string

minLength: 1

動作的設定名稱。

value

string

minLength: 1

動作設定的值。

ManagedServiceIdentity

受控服務識別(系統指派和/或使用者指派的身分識別)

名稱 類型 Description
principalId

string (uuid)

系統指派身分識別的服務主體標識碼。 此屬性只會針對系統指派的身分識別提供。

tenantId

string (uuid)

系統指派身分識別的租用戶標識碼。 此屬性只會針對系統指派的身分識別提供。

type

ManagedServiceIdentityType

受控服務識別的類型(允許 SystemAssigned 和 UserAssigned 類型)。

userAssignedIdentities

<string,  UserAssignedIdentity>

與資源相關聯的使用者指派身分識別集。 userAssignedIdentities 的字典鍵將是 ARM 資源 ID,形式為:'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. 字典值可以是要求中的空白物件({})。

ManagedServiceIdentityType

受控服務識別的類型(允許 SystemAssigned 和 UserAssigned 類型)。

值 Description
None
SystemAssigned
UserAssigned
SystemAssigned,UserAssigned

ProvisioningState

目前某個 Azure Chaos 資源的配置狀態。

值 Description
Succeeded

資源已建立。

Failed

資源建立失敗。

Canceled

資源建立已取消。

Creating

初始創建正在進行中。

Updating

更新進行中。

Deleting

刪除進行中。

Running

行動正在進行中。

SelectorType

選取器類型的列舉。

值 Description
List

列出選取器類型。

Query

查詢選取器類型。

systemData

與建立和上次修改資源相關的元數據。

名稱 類型 Description
createdAt

string (date-time)

資源建立的時間戳(UTC)。

createdBy

string

建立此資源的身分。

createdByType

createdByType

建立此資源的身分識別類型。

lastModifiedAt

string (date-time)

上次修改的資源時間戳 (UTC)

lastModifiedBy

string

上次修改資源的身分識別。

lastModifiedByType

createdByType

上次修改資源的身分識別類型。

TargetReference

代表選取器中目標參考的模型。

名稱 類型 Description
id

string (arm-id)

目標資源的資源識別符字串。

type

TargetReferenceType

目標參考類型的列舉。

TargetReferenceType

目標參考類型的列舉。

值 Description
ChaosTarget

Chaos 目標參考類型。

UserAssignedIdentity

使用者指派的身分識別屬性

名稱 類型 Description
clientId

string (uuid)

指派之身分識別的用戶端標識碼。

principalId

string (uuid)

指派之身分識別的主體標識碼。