Quickstart: Create and run a chaos experiment using Azure Chaos Studio

Get started with Chaos Studio by using VM shutdown service-direct experiment to make your service more resilient to that failure in real-world.

Prerequisites

Register the Chaos Studio resource provider

If this is your first time using Chaos Studio, you must first register the Chaos Studio resource provider before onboarding resources and creating an experiment. This must be done for each subscription where you will be using Chaos Studio.

  1. Open the Azure portal.
  2. Search for Subscriptions and open the subscription management page.
  3. Click on the subscription where you will be using Chaos Studio.
  4. In the left-hand navigation, click on Resource providers.
  5. In the list of resource providers that appears, search for Microsoft.Chaos.
  6. Click on the Microsoft.Chaos provider, and click the Register button.

Create an Azure resource supported by Chaos Studio

Create an azure resource and ensure this is one of the supported fault providers. Also validate if this resource is being created in the region where Chaos Studio is available. In this experiment we choose an Azure Virtual Machine which is one of the supported fault providers for Chaos Studio.

Enable Chaos Studio on the Virtual Machine you created

  1. Open the Azure portal.

  2. Search for Chaos Studio (preview) in the search bar.

  3. Click on Targets and navigate to your VM created.

  4. Check the box next to your VM created and click Enable targets then Enable service-direct targets from the dropdown menu.

    Targets view in the Azure portal

  5. A notification will appear indicating that the resource(s) selected were successfully enabled.

    Notification showing target successfully enabled

Create an experiment

  1. Click on Experiments.
    Go to experiment

  2. Click Add an experiment.

    Add an experiment in Azure portal

  3. Fill in the Subscription, Resource Group, and Location where you want to deploy the chaos experiment. Give your experiment a Name. Click Next : Experiment designer >

    Add experiment basics

  4. You are now in the Chaos Studio experiment designer. Give a friendly name to your Step and Branch, then click Add fault.

    Experiment designer

  5. Select VM Shutdown from the dropdown, then fill in the Duration with the number of minutes you want the failure to last.

    Fault properties

  6. Click Next: Target resources >. Add a target

  7. Click Add.

    Addt

  8. Verify that your experiment looks correct, then click Review + create, then Create.

    create the experiment

Give experiment permission to your Virtual Machine

  1. Navigate to your Virtual Machine and click on Access control (IAM). Add role assignment

  2. Click Add

    Add button

  3. Click Add role assignment

    Add role assignment button

  4. Search for Virtual Machine Contributor and select the role. Click Next.

    Choose the role for the VM

  5. Click Select members and search for your experiment name. Select your experiment and click Select. select the experiment

  6. Click Review + assign then Review + assign.

Run the chaos experiment

  1. Open the Azure portal:

  2. Check the box next to the experiments name and click Start Experiment. Start experiment

  3. Click Yes to confirm you want to start the chaos experiment.

    Confirm you want to start experiment

  4. (Optional) Click on the experiment name to see a detailed view of the execution status of the experiment.

Clean up resources

  1. Check the box next to the experiment name and click Delete.

    Select the experiment to be deleted

  2. Click Yes to confirm you want to delete the experiment.

  3. Search the VM that you created on the Azure portal search bar.

    Select the VM

  4. Click on Delete to avoid being charged for the resource.

    delete the VM

Next steps

Now that you have run a VM shutdown service-direct experiment, you are ready to: