Share via


Experiments - Create Or Update

Create or update a Experiment resource.

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

URI Parameters

Name In Required Type Description
experimentName
path True

string

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

String that represents a Experiment resource name.

resourceGroupName
path True

string

minLength: 1
maxLength: 90

The name of the resource group. The name is case insensitive.

subscriptionId
path True

string (uuid)

The ID of the target subscription. The value must be an UUID.

api-version
query True

string

minLength: 1

The API version to use for this operation.

Request Body

Name Required Type Description
location True

string

The geo-location where the resource lives

properties.selectors True ChaosTargetSelector[]:

List of selectors.

properties.steps True

ChaosExperimentStep[]

List of steps.

identity

ManagedServiceIdentity

The managed service identities assigned to this resource.

tags

object

Resource tags.

Responses

Name Type Description
200 OK

Experiment

Resource 'Experiment' update operation succeeded

201 Created

Experiment

Resource 'Experiment' create operation succeeded

Headers

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

ErrorResponse

An unexpected error response.

Security

azure_auth

Azure Active Directory OAuth2 Flow.

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

Scopes

Name Description
user_impersonation impersonate your user account

Examples

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=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"
              }
            ]
          }
        ]
      }
    ]
  }
}

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-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"
  }
}

Definitions

Name Description
ChaosExperimentBranch

Model that represents a branch in the step. 9 total per experiment.

ChaosExperimentStep

Model that represents a step in the Experiment resource.

ChaosTargetListSelector

Model that represents a list selector.

ChaosTargetQuerySelector

Model that represents a query selector.

ChaosTargetSimpleFilter

Model that represents a simple target filter.

ChaosTargetSimpleFilterParameters

Model that represents the Simple filter parameters.

ContinuousAction

Model that represents a continuous action.

createdByType

The type of identity that created the resource.

DelayAction

Model that represents a delay action.

DiscreteAction

Model that represents a discrete action.

ErrorAdditionalInfo

The resource management error additional info.

ErrorDetail

The error detail.

ErrorResponse

Error response

Experiment

Model that represents a Experiment resource.

ExperimentActionType

Enum union of Chaos experiment action types.

FilterType

Enum that discriminates between filter types. Currently only Simple type is supported.

KeyValuePair

A map to describe the settings of an action.

ManagedServiceIdentity

Managed service identity (system assigned and/or user assigned identities)

ManagedServiceIdentityType

Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).

ProvisioningState

Current provisioning state for a given Azure Chaos resource.

SelectorType

Enum of the selector type.

systemData

Metadata pertaining to creation and last modification of the resource.

TargetReference

Model that represents a reference to a Target in the selector.

TargetReferenceType

Enum of the Target reference type.

UserAssignedIdentity

User assigned identity properties

ChaosExperimentBranch

Model that represents a branch in the step. 9 total per experiment.

Name Type Description
actions ChaosExperimentAction[]:

List of actions.

name

string

minLength: 1

String of the branch name.

ChaosExperimentStep

Model that represents a step in the Experiment resource.

Name Type Description
branches

ChaosExperimentBranch[]

List of branches.

name

string

minLength: 1

String of the step name.

ChaosTargetListSelector

Model that represents a list selector.

Name Type Description
filter ChaosTargetFilter:

ChaosTargetSimpleFilter

Model that represents available filter types that can be applied to a targets list.

id

string

minLength: 1

String of the selector ID.

targets

TargetReference[]

List of Target references.

type string:

List

Chaos target selector discriminator type

ChaosTargetQuerySelector

Model that represents a query selector.

Name Type Description
filter ChaosTargetFilter:

ChaosTargetSimpleFilter

Model that represents available filter types that can be applied to a targets list.

id

string

minLength: 1

String of the selector ID.

queryString

string

Azure Resource Graph (ARG) Query Language query for target resources.

subscriptionIds

string[]

Subscription id list to scope resource query.

type string:

Query

Chaos target selector discriminator type

ChaosTargetSimpleFilter

Model that represents a simple target filter.

Name Type Description
parameters

ChaosTargetSimpleFilterParameters

Model that represents the Simple filter parameters.

type string:

Simple

Chaos target filter discriminator type

ChaosTargetSimpleFilterParameters

Model that represents the Simple filter parameters.

Name Type Description
zones

string[]

List of Azure availability zones to filter targets by.

ContinuousAction

Model that represents a continuous action.

Name Type Description
duration

string (duration)

ISO8601 formatted string that represents a duration.

name

string

maxLength: 2048

String that represents a Capability URN.

parameters

KeyValuePair[]

List of key value pairs.

selectorId

string

minLength: 1

String that represents a selector.

type string:

continuous

Chaos experiment action discriminator type

createdByType

The type of identity that created the resource.

Value Description
Application
Key
ManagedIdentity
User

DelayAction

Model that represents a delay action.

Name Type Description
duration

string (duration)

ISO8601 formatted string that represents a duration.

name

string

maxLength: 2048

String that represents a Capability URN.

type string:

delay

Chaos experiment action discriminator type

DiscreteAction

Model that represents a discrete action.

Name Type Description
name

string

maxLength: 2048

String that represents a Capability URN.

parameters

KeyValuePair[]

List of key value pairs.

selectorId

string

minLength: 1

String that represents a selector.

type string:

discrete

Chaos experiment action discriminator type

ErrorAdditionalInfo

The resource management error additional info.

Name Type Description
info

object

The additional info.

type

string

The additional info type.

ErrorDetail

The error detail.

Name Type Description
additionalInfo

ErrorAdditionalInfo[]

The error additional info.

code

string

The error code.

details

ErrorDetail[]

The error details.

message

string

The error message.

target

string

The error target.

ErrorResponse

Error response

Name Type Description
error

ErrorDetail

The error object.

Experiment

Model that represents a Experiment resource.

Name Type Description
id

string (arm-id)

Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"

identity

ManagedServiceIdentity

The managed service identities assigned to this resource.

location

string

The geo-location where the resource lives

name

string

The name of the resource

properties.provisioningState

ProvisioningState

Most recent provisioning state for the given experiment resource.

properties.selectors ChaosTargetSelector[]:

List of selectors.

properties.steps

ChaosExperimentStep[]

List of steps.

systemData

systemData

Azure Resource Manager metadata containing createdBy and modifiedBy information.

tags

object

Resource tags.

type

string

The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"

ExperimentActionType

Enum union of Chaos experiment action types.

Value Description
continuous
delay
discrete

FilterType

Enum that discriminates between filter types. Currently only Simple type is supported.

Value Description
Simple

Simple filter type.

KeyValuePair

A map to describe the settings of an action.

Name Type Description
key

string

minLength: 1

The name of the setting for the action.

value

string

minLength: 1

The value of the setting for the action.

ManagedServiceIdentity

Managed service identity (system assigned and/or user assigned identities)

Name Type Description
principalId

string (uuid)

The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity.

tenantId

string (uuid)

The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity.

type

ManagedServiceIdentityType

Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).

userAssignedIdentities

<string,  UserAssignedIdentity>

User-Assigned Identities
The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests.

ManagedServiceIdentityType

Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed).

Value Description
None
SystemAssigned
SystemAssigned,UserAssigned
UserAssigned

ProvisioningState

Current provisioning state for a given Azure Chaos resource.

Value Description
Canceled

Resource creation was canceled.

Creating

Initial creation in progress.

Deleting

Deletion in progress.

Failed

Resource creation failed.

Succeeded

Resource has been created.

Updating

Update in progress.

SelectorType

Enum of the selector type.

Value Description
List

List selector type.

Query

Query selector type.

systemData

Metadata pertaining to creation and last modification of the resource.

Name Type Description
createdAt

string (date-time)

The timestamp of resource creation (UTC).

createdBy

string

The identity that created the resource.

createdByType

createdByType

The type of identity that created the resource.

lastModifiedAt

string (date-time)

The timestamp of resource last modification (UTC)

lastModifiedBy

string

The identity that last modified the resource.

lastModifiedByType

createdByType

The type of identity that last modified the resource.

TargetReference

Model that represents a reference to a Target in the selector.

Name Type Description
id

string (arm-id)

String of the resource ID of a Target resource.

type

TargetReferenceType

Enum of the Target reference type.

TargetReferenceType

Enum of the Target reference type.

Value Description
ChaosTarget

Chaos target reference type.

UserAssignedIdentity

User assigned identity properties

Name Type Description
clientId

string (uuid)

The client ID of the assigned identity.

principalId

string (uuid)

The principal ID of the assigned identity.