Scenarios - Create Or Update

シナリオを作成または更新する。

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/workspaces/{workspaceName}/scenarios/{scenarioName}?api-version=2026-08-01-preview

URI パラメーター

名前 / 必須 説明
resourceGroupName
path True

string

minLength: 1
maxLength: 90

リソース グループの名前。 名前は大文字と小文字を区別しません。

scenarioName
path True

string

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

シナリオの名前です。

subscriptionId
path True

string (uuid)

ターゲット サブスクリプションの ID。 値は UUID である必要があります。

workspaceName
path True

string

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

ワークスペースのリソース名を表す文字列です。

api-version
query True

string

minLength: 1

この操作に使用する API バージョン。

要求本文

名前 説明
properties

ScenarioProperties

シナリオの性質。

応答

名前 説明
200 OK

Scenario

リソース「シナリオ」更新操作が成功しました

201 Created

Scenario

リソース「シナリオ」作成操作成功

Other Status Codes

ErrorResponse

予期しないエラー応答。

セキュリティ

azure_auth

Azure Active Directory OAuth2 フロー。

型: oauth2
フロー: implicit
Authorization URL (承認 URL): https://login.microsoftonline.com/common/oauth2/authorize

スコープ

名前 説明
user_impersonation あなたのユーザー アカウントになりすます

Create or update a scenario.

要求のサンプル

PUT https://management.azure.com/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/workspaces/exampleWorkspace/scenarios/zoneDownScenario?api-version=2026-08-01-preview

{
  "properties": {
    "description": "Induces an outage of all discovered VM and VMSS instances in the target zone with an option to invoke custom scripted actions using Automation Runbooks. Additionally, it forces failover of discovered Redis instances to simulate backend zonal outage.",
    "parameters": [
      {
        "name": "duration",
        "type": "string",
        "default": "PT15M",
        "required": false,
        "description": "The duration of the outage scenario."
      },
      {
        "name": "customRunbook1ResourceId",
        "type": "string",
        "required": false,
        "description": "Optional custom runbook 1 resource ID. If not provided, this action will be skipped."
      },
      {
        "name": "customRunbook1ParametersJson",
        "type": "string",
        "required": false,
        "default": "{}",
        "description": "Optional custom runbook 1 parameters in JSON format."
      }
    ],
    "actions": [
      {
        "name": "vmssZoneDown",
        "actionId": "urn:csci:microsoft:compute:shutdown/1.0.0",
        "description": "Force shutdown VMSS instances in target zone",
        "duration": "%%{parameters.duration}%%",
        "parameters": [
          {
            "key": "zones",
            "value": "%%{filters.zones}%%"
          }
        ]
      },
      {
        "name": "vmZoneDown",
        "actionId": "urn:csci:microsoft:compute:shutdown/1.0.0",
        "description": "Force shutdown VM instances in target zone",
        "duration": "%%{parameters.duration}%%",
        "parameters": [
          {
            "key": "zones",
            "value": "%%{filters.zones}%%"
          }
        ]
      },
      {
        "name": "redisFailover",
        "actionId": "urn:csci:microsoft:azureClusteredCacheForRedis:Reboot/1.0.0",
        "description": "Force failover of Redis instances to simulate backend zonal outage",
        "duration": "PT5M",
        "parameters": [
          {
            "key": "RebootType",
            "value": "PrimaryNode"
          }
        ]
      },
      {
        "name": "custom-runbook-1",
        "actionId": "urn:csci:microsoft:Automation:StartRunbook/1.0.0",
        "description": "Custom Runbook 1",
        "duration": "PT30M",
        "parameters": [
          {
            "key": "RunbookParameters",
            "value": "%%{parameters.customRunbook1ParametersJson}%%"
          }
        ],
        "externalResource": {
          "resourceId": "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Automation/automationAccounts/exampleAutomationAccount/runbooks/exampleRunbook"
        }
      }
    ]
  }
}

応答のサンプル

{
  "id": "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/workspaces/exampleWorkspace/scenarios/zoneDownScenario",
  "name": "zoneDownScenario",
  "type": "Microsoft.Chaos/workspaces/scenarios",
  "properties": {
    "provisioningState": "Succeeded",
    "version": "1.0",
    "description": "Induces an outage of all discovered VM and VMSS instances in the target zone with an option to invoke custom scripted actions using Automation Runbooks. Additionally, it forces failover of discovered Redis instances to simulate backend zonal outage.",
    "parameters": [
      {
        "name": "duration",
        "type": "string",
        "default": "PT15M",
        "required": false,
        "description": "The duration of the outage scenario."
      },
      {
        "name": "customRunbook1ResourceId",
        "type": "string",
        "required": false,
        "description": "Optional custom runbook 1 resource ID. If not provided, this action will be skipped."
      },
      {
        "name": "customRunbook1ParametersJson",
        "type": "string",
        "required": false,
        "default": "{}",
        "description": "Optional custom runbook 1 parameters in JSON format."
      }
    ],
    "actions": [
      {
        "name": "vmssZoneDown",
        "actionId": "urn:csci:microsoft:compute:shutdown/1.0.0",
        "description": "Force shutdown VMSS instances in target zone",
        "duration": "%%{parameters.duration}%%",
        "parameters": [
          {
            "key": "zones",
            "value": "%%{filters.zones}%%"
          }
        ]
      },
      {
        "name": "vmZoneDown",
        "actionId": "urn:csci:microsoft:compute:shutdown/1.0.0",
        "description": "Force shutdown VM instances in target zone",
        "duration": "%%{parameters.duration}%%",
        "parameters": [
          {
            "key": "zones",
            "value": "%%{filters.zones}%%"
          }
        ]
      },
      {
        "name": "redisFailover",
        "actionId": "urn:csci:microsoft:azureClusteredCacheForRedis:Reboot/1.0.0",
        "description": "Force failover of Redis instances to simulate backend zonal outage",
        "duration": "PT5M",
        "parameters": [
          {
            "key": "RebootType",
            "value": "PrimaryNode"
          }
        ]
      },
      {
        "name": "custom-runbook-1",
        "actionId": "urn:csci:microsoft:Automation:StartRunbook/1.0.0",
        "description": "Custom Runbook 1",
        "duration": "PT30M",
        "parameters": [
          {
            "key": "RunbookParameters",
            "value": "%%{parameters.customRunbook1ParametersJson}%%"
          }
        ],
        "externalResource": {
          "resourceId": "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Automation/automationAccounts/exampleAutomationAccount/runbooks/exampleRunbook"
        }
      }
    ]
  },
  "systemData": {
    "createdAt": "2025-01-15T10:30:00.000Z",
    "createdBy": "admin@contoso.com",
    "createdByType": "User",
    "lastModifiedAt": "2025-01-15T10:30:00.000Z",
    "lastModifiedBy": "admin@contoso.com",
    "lastModifiedByType": "User"
  }
}
{
  "id": "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/workspaces/exampleWorkspace/scenarios/zoneDownScenario",
  "name": "zoneDownScenario",
  "type": "Microsoft.Chaos/workspaces/scenarios",
  "properties": {
    "provisioningState": "Creating",
    "version": "1.0",
    "description": "Induces an outage of all discovered VM and VMSS instances in the target zone with an option to invoke custom scripted actions using Automation Runbooks. Additionally, it forces failover of discovered Redis instances to simulate backend zonal outage.",
    "parameters": [
      {
        "name": "duration",
        "type": "string",
        "default": "PT15M",
        "required": false,
        "description": "The duration of the outage scenario."
      },
      {
        "name": "customRunbook1ResourceId",
        "type": "string",
        "required": false,
        "description": "Optional custom runbook 1 resource ID. If not provided, this action will be skipped."
      },
      {
        "name": "customRunbook1ParametersJson",
        "type": "string",
        "required": false,
        "default": "{}",
        "description": "Optional custom runbook 1 parameters in JSON format."
      }
    ],
    "actions": [
      {
        "name": "vmssZoneDown",
        "actionId": "urn:csci:microsoft:compute:shutdown/1.0.0",
        "description": "Force shutdown VMSS instances in target zone",
        "duration": "%%{parameters.duration}%%",
        "parameters": [
          {
            "key": "zones",
            "value": "%%{filters.zones}%%"
          }
        ]
      },
      {
        "name": "vmZoneDown",
        "actionId": "urn:csci:microsoft:compute:shutdown/1.0.0",
        "description": "Force shutdown VM instances in target zone",
        "duration": "%%{parameters.duration}%%",
        "parameters": [
          {
            "key": "zones",
            "value": "%%{filters.zones}%%"
          }
        ]
      },
      {
        "name": "redisFailover",
        "actionId": "urn:csci:microsoft:azureClusteredCacheForRedis:Reboot/1.0.0",
        "description": "Force failover of Redis instances to simulate backend zonal outage",
        "duration": "PT5M",
        "parameters": [
          {
            "key": "RebootType",
            "value": "PrimaryNode"
          }
        ]
      },
      {
        "name": "custom-runbook-1",
        "actionId": "urn:csci:microsoft:Automation:StartRunbook/1.0.0",
        "description": "Custom Runbook 1",
        "duration": "PT30M",
        "parameters": [
          {
            "key": "RunbookParameters",
            "value": "%%{parameters.customRunbook1ParametersJson}%%"
          }
        ],
        "externalResource": {
          "resourceId": "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Automation/automationAccounts/exampleAutomationAccount/runbooks/exampleRunbook"
        }
      }
    ]
  },
  "systemData": {
    "createdAt": "2025-01-15T10:30:00.000Z",
    "createdBy": "admin@contoso.com",
    "createdByType": "User",
    "lastModifiedAt": "2025-01-15T10:30:00.000Z",
    "lastModifiedBy": "admin@contoso.com",
    "lastModifiedByType": "User"
  }
}

定義

名前 説明
ActionDependency

アクション依存性を表すモデル。

ActionDependencyType

アクション依存タイプのための列挙。

ActionLifecycle

アクションライフサイクル状態のための列挙式です。

createdByType

リソースを作成した ID の種類。

ErrorAdditionalInfo

リソース管理エラーの追加情報

ErrorDetail

エラーの詳細。

ErrorResponse

エラー応答

ExternalResource

外部リソース参照を表すモデル。

KeyValuePair

アクションや構成のパラメータを記述するために使われるキーと値のペア。

ParameterType

パラメータ型のための列挙。

ProvisioningState

特定のAzure Chaosリソースの現在のプロビジョニング状態。

Recommendation

シナリオ推奨を表すモデル。

RecommendationStatus

シナリオ検証状態の列挙。

RunAfter

アクション依存性を表すモデル。

RunAfterBehavior

複数の依存関係をどのように評価するかを定義します。

Scenario

シナリオを表すモデルです。

ScenarioAction

シナリオアクションを表すモデル。

ScenarioParameter

単一のシナリオパラメータ定義を表すモデル。

ScenarioProperties

シナリオの性質を表すモデルです。

systemData

リソースの作成と最後の変更に関連するメタデータ。

ActionDependency

アクション依存性を表すモデル。

名前 説明
name

string

これはアクションの名前によります。

onActionLifecycle

ActionLifecycle

このアクションを開始する依存性アクションのライフサイクル状態。

type

ActionDependencyType

依存の種類。

ActionDependencyType

アクション依存タイプのための列挙。

説明
Action

アクション依存タイプ。

ActionLifecycle

アクションライフサイクル状態のための列挙式です。

説明
AnyTerminal

アクションが任意の終端状態に達したときにトリガーされます。

Start

アクションが始まったときにトリガーします。

Running

アクションが進行中でトリガーします。

Success

成功時にトリガー。

Failure

失敗時にトリガー。

Skipped

アクションがスキップされたときにトリガーします。

createdByType

リソースを作成した ID の種類。

説明
User
Application
ManagedIdentity
Key

ErrorAdditionalInfo

リソース管理エラーの追加情報

名前 説明
info

object

追加情報。

type

string

追加情報の種類。

ErrorDetail

エラーの詳細。

名前 説明
additionalInfo

ErrorAdditionalInfo[]

エラーに関する追加情報。

code

string

エラー コード。

details

ErrorDetail[]

エラーの詳細。

message

string

エラー メッセージ。

target

string

エラーの対象。

ErrorResponse

エラー応答

名前 説明
error

ErrorDetail

エラー オブジェクト。

ExternalResource

外部リソース参照を表すモデル。

名前 説明
resourceId

string (arm-id)

外部リソースのリソースID

KeyValuePair

アクションや構成のパラメータを記述するために使われるキーと値のペア。

名前 説明
key

string

minLength: 1

アクションの設定の名前。

value

string

minLength: 1

アクションの設定の値。

ParameterType

パラメータ型のための列挙。

説明
string

文字列パラメータ型。

number

数値パラメータの種類。

boolean

ブールパラメータ型。

object

オブジェクトパラメータタイプ。

array

配列パラメータ型。

ProvisioningState

特定のAzure Chaosリソースの現在のプロビジョニング状態。

説明
Succeeded

リソースが作成されました。

Failed

リソースの作成に失敗しました。

Canceled

リソースの作成が取り消されました。

Creating

初期作成が進行中です。

Updating

更新が進行中です。

Deleting

削除が進行中です。

Running

アクションが始まっています。

Recommendation

シナリオ推奨を表すモデル。

名前 説明
evaluationRunAt

string (date-time)

推薦が評価されたUTC時刻。

recommendationStatus

RecommendationStatus

推薦の状況。

RecommendationStatus

シナリオ検証状態の列挙。

説明
NotEvaluated

シナリオ推奨の状況は評価されていません。

Recommended

シナリオ推奨ステータスは推奨されます。

NotApplicable

シナリオ推奨のステータスは適用されません。

Evaluating

シナリオ推奨の状況は現在評価中です。

EvaluationFailed

シナリオ推奨評価は失敗しました。

EvaluationCancelled

シナリオ推奨評価は中止されました。

RunAfter

アクション依存性を表すモデル。

名前 規定値 説明
behavior

RunAfterBehavior

Any

複数の依存関係をどのように評価するかを定義します。

items

ActionDependency[]

アクション依存関係の配列。

RunAfterBehavior

複数の依存関係をどのように評価するかを定義します。

説明
Any

すべての依存関係の後も必ず継続されます(例えば、最終ブロックのようなものです)。

All

すべての依存関係が満たされていなければ継続できません。

AtLeastOne

継続するには少なくとも1つの依存関係が満たされなければなりません。

Scenario

シナリオを表すモデルです。

名前 説明
id

string (arm-id)

リソースの完全修飾リソース ID。 例: "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}"

name

string

リソースの名前

properties

ScenarioProperties

シナリオの性質。

systemData

systemData

createdBy および modifiedBy 情報を含む Azure Resource Manager メタデータ。

type

string

リソースの種類。 例: "Microsoft.Compute/virtualMachines" または "Microsoft.Storage/storageAccounts"

ScenarioAction

シナリオアクションを表すモデル。

名前 説明
actionId

string

アクションの識別子とバージョン(例:「microsoft-compute-shutdown/1.0」)。

description

string

この動作が何をするかを人間が読みやすく説明する。

duration

string

ISO 8601の動作時間(例:PT30Mで30分間)を表示します。 テンプレートマクロ構文(%%{parameters.<name>}%%)。

externalResource

ExternalResource

アクションのための外部リソース参照。

name

string

pattern: ^[a-zA-Z0-9-_]+$

アクションのユニークな名前です。

parameters

KeyValuePair[]

アクション固有のパラメータ値。

runAfter

RunAfter

アクションの開始時期を制御するアクション依存関係。

timeout

string

ISO 8601の実行時間は最大実行時間です。 テンプレートマクロ構文をサポートしています。

waitBefore

string

ISO 8601の動作開始までの待機時間(例:PT30Sの30秒間)です。 テンプレートマクロ構文をサポートしています。

ScenarioParameter

単一のシナリオパラメータ定義を表すモデル。

名前 説明
default

string

パラメータのデフォルト値。

description

string

パラメーターの説明。

name

string

minLength: 1

パラメーターの名前。

required

boolean

このパラメータが必要かどうか。

type

ParameterType

パラメータデータ型。

ScenarioProperties

シナリオの性質を表すモデルです。

名前 説明
actions

ScenarioAction[]

シナリオのオーケストレーションを定義する一連のアクション。

createdFrom

string

このシナリオが作成されたテンプレートバージョンのリソースID(任意)。

description

string

このシナリオが何をするのかの説明(任意)。

parameters

ScenarioParameter[]

シナリオのパラメータ定義。

provisioningState

ProvisioningState

与えられたシナリオリソースの最新のプロビジョニング状態。

recommendation

Recommendation

このシナリオの推奨情報。

version

string

シナリオのバージョンです。

systemData

リソースの作成と最後の変更に関連するメタデータ。

名前 説明
createdAt

string (date-time)

リソース作成のタイムスタンプ (UTC)。

createdBy

string

リソースを作成した ID。

createdByType

createdByType

リソースを作成した ID の種類。

lastModifiedAt

string (date-time)

リソースの最終変更のタイムスタンプ (UTC)

lastModifiedBy

string

リソースを最後に変更した ID。

lastModifiedByType

createdByType

リソースを最後に変更した ID の種類。