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.
- An Azure subscription. If you don't have an Azure subscription, create an Azure free account before you begin.
- A Linux virtual machine. If you do not have a virtual machine, you can follow these steps to create one.
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.
- Open the Azure portal.
- Search for Subscriptions and open the subscription management page.
- Click on the subscription where you will be using Chaos Studio.
- In the left-hand navigation, click on Resource providers.
- In the list of resource providers that appears, search for Microsoft.Chaos.
- Click on the Microsoft.Chaos provider, and click the Register button.
Enable Chaos Studio on the Virtual Machine you created
Open the Azure portal.
Search for Chaos Studio (preview) in the search bar.
Click on Targets and navigate to your VM created.
Check the box next to your VM created and click Enable targets then Enable service-direct targets from the dropdown menu.
A notification will appear indicating that the resource(s) selected were successfully enabled.
Create an experiment
Click on Experiments.
Click Add an experiment.
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 >
You are now in the Chaos Studio experiment designer. Give a friendly name to your Step and Branch, then click Add fault.
Select VM Shutdown from the dropdown, then fill in the Duration with the number of minutes you want the failure to last.
Click Next: Target resources >.
Verify that your experiment looks correct, then click Review + create, then Create.
Give experiment permission to your Virtual Machine
Navigate to your Virtual Machine and click on Access control (IAM).
Click Add role assignment
Search for Virtual Machine Contributor and select the role. Click Next.
Click Select members and search for your experiment name. Select your experiment and click Select.
Click Review + assign then Review + assign.
Run the chaos experiment
Open the Azure portal:
Check the box next to the experiments name and click Start Experiment.
Click Yes to confirm you want to start the chaos experiment.
(Optional) Click on the experiment name to see a detailed view of the execution status of the experiment.
Clean up resources
Check the box next to the experiment name and click Delete.
Click Yes to confirm you want to delete the experiment.
Search the VM that you created on the Azure portal search bar.
Click on Delete to avoid being charged for the resource.
Now that you have run a VM shutdown service-direct experiment, you are ready to: