نماذج قالب ARM للتجارب في Azure Chaos Studio

تتضمن هذه المقالة نموذج قوالب Azure Resource Manager (قوالب ARM) لإنشاء تجربة فوضى في Azure Chaos Studio. يتضمن كل نموذج ملف قالب وملف معلمات مع قيم عينة لتوفيرها للقالب.

إنشاء تجربة (عينة)

في هذه العينة، نقوم بإنشاء تجربة فوضى مع مورد هدف واحد وخطأ واحد في ضغط وحدة المعالجة المركزية. يمكنك تعديل التجربة عن طريق الرجوع إلى واجهة برمجة تطبيقات REST ومكتبة الخطأ.

نشر القوالب

بمجرد مراجعة ملفات القالب والمعلمات، تعرف على كيفية نشرها في اشتراك Azure الخاص بك باستخدام مقالة نشر الموارد باستخدام قوالب ARM ومدخل Azure.

ملف القالب

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
    "experimentName": {
      "type": "string",
      "defaultValue": "simple-experiment",
      "metadata": {
        "description": "A name for the experiment."
      }
    },
    "location": {
      "type": "string",
      "defaultValue": "[resourceGroup().location]",
      "metadata": {
        "description": "A region where the experiment will be deployed."
      }
    },
    "chaosTargetResourceId": {
      "type": "string",
      "metadata": {
        "description": "Resource ID of the chaos target. This is the full resource ID of the resource being targeted plus the target proxy resource."
      }
    }
  },
  "functions": [],
  "variables": {},
  "resources": [
    {
      "type": "Microsoft.Chaos/experiments",
      "apiVersion": "2024-01-01",
      "name": "[parameters('experimentName')]",
      "location": "[parameters('location')]",
      "identity": {
        "type": "SystemAssigned"
      },
      "properties": {
        "selectors": [
          {
            "id": "Selector1",
            "type": "List",
            "targets": [
              {
                "type": "ChaosTarget",
                "id": "[parameters('chaosTargetResourceId')]"
              }
            ]
          }
        ],
        "steps": [
          {
            "name": "Step1",
            "branches": [
              {
                "name": "Branch1",
                "actions": [
                  {
                    "duration": "PT10M",
                    "name": "urn:csci:microsoft:agent:cpuPressure/1.0",
                    "parameters": [
                      {
                        "key": "pressureLevel",
                        "value": "95"
                      }
                    ],
                    "selectorId": "Selector1",
                    "type": "continuous"
                  }
                ]
              }
            ]
          }
        ]
      }
    }
  ],
  "outputs": {}
}

ملف المعلمة

{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {
      "experimentName": {
        "value": "my-first-experiment"
      },
      "location": {
        "value": "eastus"
      },
      "chaosTargetResourceId": {
        "value": "/subscriptions/<subscription-id>/resourceGroups/<rg-name>/providers/Microsoft.DocumentDB/databaseAccounts/<account-name>/providers/Microsoft.Chaos/targets/microsoft-cosmosdb"
      }
  }
}

الخطوات التالية