Use a chaos experiment template to take down Virtual Machine Scale Set availability zones with autoscale disabled
You can use a chaos experiment to verify that your application is resilient to failures by causing those failures in a controlled environment. In this article, you take down an availability zone (with autoscale disabled) of a Virtual Machine Scale Sets instance using a pre-populated experiment template and Azure Chaos Studio.
Prerequisites
- An Azure subscription. If you don't have an Azure subscription, create an Azure free account before you begin.
- A Virtual Machine Scale Sets instance.
- An Autoscale Settings instance.
Enable Chaos Studio on your Virtual Machine Scale Sets and Autoscale Settings instances
Azure Chaos Studio can't inject faults against a resource until that resource is added to Chaos Studio. To add a resource to Chaos Studio, create a target and capabilities on the resource. Virtual Machine Scale Sets has only one target type (Microsoft-VirtualMachineScaleSet
) and one capability (shutdown
). Autoscale Settings has only one target type (Microsoft-AutoScaleSettings
) and one capability (disableAutoscale
). Other resources might have up to two target types. One target type is for service-direct faults. Another target type is for agent-based faults. Other resources might have many other capabilities.
Open the Azure portal.
Search for Chaos Studio in the search bar.
Select Targets and find your autoscale setting resource.
Select the autoscale setting resource and select Enable targets > Enable service-direct targets.
Select Review + Enable > Enable.
Find your virtual machine scale set resource.
Select the virtual machine scale set resource and select Enable targets > Enable service-direct targets.
Select Review + Enable > Enable.
You've now successfully added your autoscale setting and virtual machine scale set to Chaos Studio.
Create an experiment from a template
Now you can create your experiment from a pre-filled experiment template. A chaos experiment defines the actions you want to take against target resources. The actions are organized and run in sequential steps. The chaos experiment also defines the actions you want to take against branches, which run in parallel.
In Chaos Studio, go to Experiments > Create > New from template.
Select Availability Zone Down.
Add a name for your experiment that complies with resource naming guidelines. Select Next: Permissions.
For your chaos experiment to run successfully, it must have sufficient permissions on target resources. Select a system-assigned managed identity or a user-assigned managed identity for your experiment. You can choose to enable custom role assignment if you would like Chaos Studio to add the necessary permissions to run (in the form of a custom role) to your experiment's identity. Select Next: Experiment designer.
Within the Disable Autoscale fault, select Edit.
Review fault parameters and select Next: Target resources.
Select the autoscale setting resource that you want to use in the experiment. Select Save.
Within the VMSS Shutdown (version 2.0) fault, select Edit.
Review fault parameters and select Next: Target resources.
Select the virtual machine scale set resource that you want to use in the experiment. Select Next: Scope.
Select the zone(s) within your virtual machine scale set you would like to take down. Select Save.
Select Review + create > Create to save the experiment.
Run your experiment
You're now ready to run your experiment.
- In the Experiments view, select your experiment. Select Start > OK.
- When Status changes to Running, select Details for the latest run under History to see details for the running experiment.
Next steps
Now that you've run an Availability Zone Down template experiment, you're ready to: