你当前正在访问 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=2025-01-01
URI 参数
名称 | 在 | 必需 | 类型 | 说明 |
---|---|---|---|---|
experiment
|
path | True |
string |
表示试验资源名称的字符串。 正则表达式模式: |
resource
|
path | True |
string |
资源组的名称。 名称不区分大小写。 |
subscription
|
path | True |
string uuid |
目标订阅的 ID。 该值必须是 UUID。 |
api-version
|
query | True |
string |
用于此作的 API 版本。 |
请求正文
名称 | 必需 | 类型 | 说明 |
---|---|---|---|
location | True |
string |
资源所在的地理位置 |
properties.selectors | True | ChaosTargetSelector[]: |
选择器列表。 |
properties.steps | True |
步骤列表。 |
|
identity |
分配给此资源的托管服务标识。 |
||
tags |
object |
资源标记。 |
响应
名称 | 类型 | 说明 |
---|---|---|
200 OK |
资源“试验”更新作成功 |
|
201 Created |
资源“试验”创建作成功 标头
|
|
Other Status Codes |
意外的错误响应。 |
安全性
azure_auth
Azure Active Directory OAuth2 Flow。
类型:
oauth2
流向:
implicit
授权 URL:
https://login.microsoftonline.com/common/oauth2/authorize
作用域
名称 | 说明 |
---|---|
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=2025-01-01
{
"identity": {
"type": "SystemAssigned"
},
"tags": {
"key7131": "ryohwcoiccwsnewjigfmijz",
"key2138": "fjaeecgnvqd"
},
"location": "eastus2euap",
"properties": {
"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=2024-11-01-preview
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-11-01-preview
{
"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": {
"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=2024-11-01-preview
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-11-01-preview
{
"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": {
"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"
}
}
定义
名称 | 说明 |
---|---|
Chaos |
表示步骤中的分支的模型。 每个试验总共 9 个。 |
Chaos |
表示试验资源中的步骤的模型。 |
Chaos |
表示列表选择器的模型。 |
Chaos |
表示查询选择器的模型。 |
Chaos |
表示简单目标筛选器的模型。 |
Chaos |
表示简单筛选器参数的模型。 |
Continuous |
表示连续作的模型。 |
created |
创建资源的标识的类型。 |
Delay |
表示延迟作的模型。 |
Discrete |
表示离散作的模型。 |
Error |
资源管理错误附加信息。 |
Error |
错误详细信息。 |
Error |
错误响应 |
Experiment |
表示试验资源的模型。 |
Experiment |
混沌试验作类型的枚举联合。 |
Filter |
区分筛选器类型的枚举。 目前仅支持 |
Key |
描述作设置的映射。 |
Managed |
托管服务标识(系统分配和/或用户分配的标识) |
Managed |
托管服务标识的类型(其中允许 SystemAssigned 和 UserAssigned 类型)。 |
Provisioning |
给定 Azure 混沌资源的当前预配状态。 |
Selector |
选择器类型的枚举。 |
system |
与创建和上次修改资源相关的元数据。 |
Target |
表示对选择器中目标的引用的模型。 |
Target |
目标引用类型的枚举。 |
User |
用户分配的标识属性 |
ChaosExperimentBranch
表示步骤中的分支的模型。 每个试验总共 9 个。
名称 | 类型 | 说明 |
---|---|---|
actions | ChaosExperimentAction[]: |
作列表。 |
name |
string |
分支名称的字符串。 |
ChaosExperimentStep
表示试验资源中的步骤的模型。
名称 | 类型 | 说明 |
---|---|---|
branches |
分支列表。 |
|
name |
string |
步骤名称的字符串。 |
ChaosTargetListSelector
表示列表选择器的模型。
名称 | 类型 | 说明 |
---|---|---|
filter | ChaosTargetFilter: |
表示可应用于目标列表的可用筛选器类型的模型。 |
id |
string |
选择器 ID 的字符串。 |
targets |
目标引用列表。 |
|
type |
string:
List |
混沌目标选择器鉴别器类型 |
ChaosTargetQuerySelector
表示查询选择器的模型。
名称 | 类型 | 说明 |
---|---|---|
filter | ChaosTargetFilter: |
表示可应用于目标列表的可用筛选器类型的模型。 |
id |
string |
选择器 ID 的字符串。 |
queryString |
string |
针对目标资源的 Azure Resource Graph (ARG) 查询语言查询。 |
subscriptionIds |
string[] |
用于限定资源查询范围的订阅 ID 列表。 |
type |
string:
Query |
混沌目标选择器鉴别器类型 |
ChaosTargetSimpleFilter
表示简单目标筛选器的模型。
名称 | 类型 | 说明 |
---|---|---|
parameters |
表示简单筛选器参数的模型。 |
|
type |
string:
Simple |
混沌目标筛选器鉴别器类型 |
ChaosTargetSimpleFilterParameters
表示简单筛选器参数的模型。
名称 | 类型 | 说明 |
---|---|---|
zones |
string[] |
要按其筛选目标的 Azure 可用性区域列表。 |
ContinuousAction
表示连续作的模型。
名称 | 类型 | 说明 |
---|---|---|
duration |
string |
ISO8601表示持续时间的格式化字符串。 |
name |
string |
表示功能 URN 的字符串。 |
parameters |
键值对列表。 |
|
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 |
键值对列表。 |
|
selectorId |
string |
表示选择器的字符串。 |
type |
string:
discrete |
混沌实验作鉴别器类型 |
ErrorAdditionalInfo
资源管理错误附加信息。
名称 | 类型 | 说明 |
---|---|---|
info |
object |
其他信息。 |
type |
string |
其他信息类型。 |
ErrorDetail
错误详细信息。
名称 | 类型 | 说明 |
---|---|---|
additionalInfo |
错误附加信息。 |
|
code |
string |
错误代码。 |
details |
错误详细信息。 |
|
message |
string |
错误消息。 |
target |
string |
错误目标。 |
ErrorResponse
错误响应
名称 | 类型 | 说明 |
---|---|---|
error |
错误对象。 |
Experiment
表示试验资源的模型。
名称 | 类型 | 说明 |
---|---|---|
id |
string |
资源的完全限定资源 ID。 例如“/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}” |
identity |
分配给此资源的托管服务标识。 |
|
location |
string |
资源所在的地理位置 |
name |
string |
资源的名称 |
properties.provisioningState |
给定试验资源的最新预配状态。 |
|
properties.selectors | ChaosTargetSelector[]: |
选择器列表。 |
properties.steps |
步骤列表。 |
|
systemData |
包含 createdBy 和 modifiedBy 信息的 Azure 资源管理器元数据。 |
|
tags |
object |
资源标记。 |
type |
string |
资源的类型。 例如“Microsoft.Compute/virtualMachines”或“Microsoft.Storage/storageAccounts” |
ExperimentActionType
混沌试验作类型的枚举联合。
名称 | 类型 | 说明 |
---|---|---|
continuous |
string |
|
delay |
string |
|
discrete |
string |
FilterType
区分筛选器类型的枚举。 目前仅支持 Simple
类型。
名称 | 类型 | 说明 |
---|---|---|
Simple |
string |
简单筛选器类型。 |
KeyValuePair
描述作设置的映射。
名称 | 类型 | 说明 |
---|---|---|
key |
string |
作的设置的名称。 |
value |
string |
作设置的值。 |
ManagedServiceIdentity
托管服务标识(系统分配和/或用户分配的标识)
名称 | 类型 | 说明 |
---|---|---|
principalId |
string |
系统分配标识的服务主体 ID。 此属性仅针对系统分配的标识提供。 |
tenantId |
string |
系统分配标识的租户 ID。 此属性仅针对系统分配的标识提供。 |
type |
托管服务标识的类型(其中允许 SystemAssigned 和 UserAssigned 类型)。 |
|
userAssignedIdentities |
<string,
User |
User-Assigned 标识 |
ManagedServiceIdentityType
托管服务标识的类型(其中允许 SystemAssigned 和 UserAssigned 类型)。
名称 | 类型 | 说明 |
---|---|---|
None |
string |
|
SystemAssigned |
string |
|
SystemAssigned,UserAssigned |
string |
|
UserAssigned |
string |
ProvisioningState
给定 Azure 混沌资源的当前预配状态。
名称 | 类型 | 说明 |
---|---|---|
Canceled |
string |
资源创建已取消。 |
Creating |
string |
初始创建正在进行中。 |
Deleting |
string |
正在删除。 |
Failed |
string |
资源创建失败。 |
Succeeded |
string |
已创建资源。 |
Updating |
string |
正在进行更新。 |
SelectorType
选择器类型的枚举。
名称 | 类型 | 说明 |
---|---|---|
List |
string |
列表选择器类型。 |
Query |
string |
查询选择器类型。 |
systemData
与创建和上次修改资源相关的元数据。
名称 | 类型 | 说明 |
---|---|---|
createdAt |
string |
资源创建时间戳(UTC)。 |
createdBy |
string |
创建资源的标识。 |
createdByType |
创建资源的标识的类型。 |
|
lastModifiedAt |
string |
上次修改的资源时间戳(UTC) |
lastModifiedBy |
string |
上次修改资源的标识。 |
lastModifiedByType |
上次修改资源的标识的类型。 |
TargetReference
表示对选择器中目标的引用的模型。
名称 | 类型 | 说明 |
---|---|---|
id |
string |
目标资源的资源 ID 的字符串。 |
type |
目标引用类型的枚举。 |
TargetReferenceType
目标引用类型的枚举。
名称 | 类型 | 说明 |
---|---|---|
ChaosTarget |
string |
混沌目标引用类型。 |
UserAssignedIdentity
用户分配的标识属性
名称 | 类型 | 说明 |
---|---|---|
clientId |
string |
分配的标识的客户端 ID。 |
principalId |
string |
已分配标识的主体 ID。 |