>> Welcome to Azure Tips and Tricks.
In this episode, we'll take a look at Azure Chaos Studio.
I have an existing application that
runs in an App Service web app.
This one, this simple website,
uses Azure Cache for Redis to get its data and
display it. If the cache isn't available,
it should get it from a database so
it should still work.
We can test that with Azure Chaos Studio.
Before we can start, we need to make
sure that we can use Chaos Studio.
Here in my Azure subscription,
I need to check the resource providers, and I
need to check the Microsoft.Chaos provider. This one.
It isn't registered for my subscription,
so I need to do that before I can use Chaos Studio.
With that out of the way, let's get started.
Let's search for chaos and go to the Azure Chaos Studio.
Here it is. In Chaos Studio,
we can enable services that will be targeted by
Chaos experiments and then create and run those experiments.
Let's start by enabling targets.
These are the Azure services that I can
enable and use with Chaos Studio.
I can, for instance,
select them all and enable them to be used.
I can do that as
service direct targets, and for some resources like VMs,
I can do that with agents which
enable different capabilities for Chaos Studio.
Let's enabled these services.
Now that they are, let's select
the Azure Cache for Redis that is used by my website.
Here, I can manage the actions that
Chaos Studio can execute against this service.
In this case, it's just one, which is rebooting
the cache, and you can see here that for agent-based services,
I can enable different actions.
Very cool. Let's save this.
Now for the experiment, let's see.
I'll add an experiment from here.
First, the basics.
I'll pick a resource group, and
also, I'll enter a name for the experiment.
Next. This is the designer,
here I can define multiple steps,
branches, and faults. I'll keep it simple.
Let's add an action and make it a fault.
Here we go. I'll pick the Azure Cache for Redis (Reboot) fault.
This is what I want to test, and in the parameters
here, I'll select unknown for the reboot type, and that's it.
Next, target resources.
Here, I can pick the Azure Cache for Redis that we want to
reboot and add the fault. That's it.
Like I said, I'll keep this experiment simple and create it.
Now, before we start the experiments,
we need to grant explicit access for
this experiment to Azure Cache for Redis.
We need to do this so that we don't
accidentally create chaos in the wrong applications.
So here in Azure Cache for Redis,
select "Access control" and now we will add a role assignment.
I want the experiment to be a contributor and next.
The experiment has a managed identity that we can use.
Let's select this and now to add the experiment as a member.
Here in managed identities,
I can select Chaos Experiment,
and there it is.
Let's add it as a member and then assign it the
contributor role on the Azure Cache for Redis. That's it.
Here we are in the Chaos Experiment again,
and it has already executed,
as you can see here.
Let's take a look at the result details.
Now we can see the steps of
the experiment and its branches and faults.
It looks like everything ran successfully,
which means that the Azure Cache for Redis rebooted. Very cool.
Now, for the real test. Here is
Application Insights for the web app that runs the website,
and I can see here that
the cache reboot didn't affect the website availability,
which is exactly what I want.
Azure Chaos Studio is a great tool to model and execute
real-world chaos for your applications by
injecting many types of faults into your solution.
You can use this to test and improve
the resilience of your applications and infrastructure.
Go and check it out.