3.10 Event Grid Demo

Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *

Already have an account? Sign In »

19 hours 58 minutes
Video Transcription
Welcome back on this episode, we're gonna finish up our surveillance, compute concepts by taking a look and in a victory, a demo.
My objective includes going out to the azure portal. We're gonna take a look how we can integrate event grid into a lodge. A cap.
Remember, Event great is kind of the glue between event sources and event handlers inside of Azure. In our case, we're going to take an event source such as a virtual machine,
and we're going to combine it with a logic app to perform a function like sending an email. Let's jump out to the azure portal and see what this looks like
back in our eyes. Reporter, we're gonna walk through a demo of how we can incorporate event grid into a logic app.
Now, I've already got the logic at Built, so let's go in and take a look at the designer to see how it is built.
Now, if you remember our logic, APS have to be triggered by something. Something has to occur whether data is updated, something's posted, maybe to a SharePoint list.
Something has to trigger the logic app to occur.
And the first trigger I've chosen here is when a resource event occurs
and this resource event comes out of azure event grid.
Remember, as a raving cred is ingesting all of these changes that are occurring insider as your tenant.
If we expand this out, we can take a look at some of the properties we have set on it.
First, I've chosen a subscription that I want to monitor as well as a resource type. Here. I'm looking at resource groups,
and after that I have to choose a resource group name that I want to monitor. So what this even grid trigger is doing is looking at all the actions that air coming out of our resource group and the resource is in it for server lis demo RG.
Our action after that is called a condition, and I've renamed that condition from his generic name to V M and Resource Group has changed. So let's take a look at its actions.
What we're looking at here is the information that occurs in the in vic grid when something happens. What I'm gonna do is I'm gonna delete this condition and show you how I recreated it. So you understand what we're looking at
going to go where to expression
and paste. In this expression,
what we're looking at is the trigger body. This is the event we have right above this titled When it resource event occurs. We're looking at its data and we're looking for a field called Operation Name. Now, after we get this logic app to fire, I'll show you where we got this information from. But for right now, just understand that we're looking for an operation name
based off the event grid trigger.
And what we're doing inside of that trigger is we're comparing that operation name and we're looking for an exact match to Microsoft that compute slash virtual machines slash right, So we're looking for right operations against our virtual machine when we see a match for that.
Under this if true option, I've added an action to send an email.
And in this send an email action. I've built out how I want the email to look in the body of the email, have added several keys here, and their values are based off data coming out of the event grid.
Let's take a look at what other options we have.
We've already got the event time in the event type as well as the I. D. We've already put the subject of the event into the subject of the E mail and then we have the topic name that fired the event. This is the dynamic content we have available that's coming out of the event source. In this case, our resource group.
We don't have any false actions if it doesn't match what we're looking for back up in this condition, basically writing and making a change to virtue machine that we don't care if anything happens or not.
Let's hop over to our virtual machine so we can see how a change on a virtual machine and that resource group that were targeting will trigger this logic app through the event grid and send us an email.
One way to make a change is to change the hardware profile of the virtual machine.
Right now we're on a standard B one s
and I'm going to change it to a B two s.
And if you change the size of a virtual machine while it's running, it will need to shut down the virtual machine, make the change, and then restart it.
Our virgin machine is done being resized. So let's go back to our logic app.
And on our overview page we can see a summary,
and here we can see the runs history of every time this logic app has been triggered.
As you can see, it's happening quite a bit because we're looking at any change inside of that resource group. But we're only going to send an email when the virtual machine has a right action taken against it. So let's go look at our latest triggered run history.
Let me zoom out here just a little bit so we can fit it all on the screen.
So it just so happens that this last run in our run history is the one we're looking for. You can see that our expression result is true,
which means the condition we put in there evaluated to true, and the screen check mark right here shows that it sent an email. So let's go check our inbox.
And here we have a couple of emails that have conned gone through for each time we had a right success onto our virtual machine,
and you can see in the email. It's configured with the properties that we described in the Send an email action. We have the resource, the event type, the event I D. And the time that it occurred.
Let's go back to our logic app
if we go back to when a resource event occurs.
If we look at our resource event trigger out of our event grid,
we can look at the raw output that came out of the event grid.
We scroll down to the bottom.
We're going to see in operation name here
for Microsoft. I compute slash virtual machines slash Right
now, let me go back to the logic app designer
and inside of our condition.
That's exactly what we're looking for. So what this condition is doing is it's parsing that Jason response looking inside a data operation name and we're matching exactly on this value over here on the right, So out of the event grid when that condition is matched out of the output is when we actually go down to this if true
and send an email.
Oh, that makes sense. I'm just trying to show that there is a bunch of data that is coming out of our event grid, and in this case we are basing it often Operation name of were riding to virtual machines.
When that condition is true, we're going to go in and send an email. Now Sending an email is a little bit of a minor action, but you could do additional things.
For instance, like we talked about in the slides, you could monitor the event grid for when a new virtual machine is made and inside of your logic, AP go and create an action of running an azure run book inside of Azure automation to configure that virtual machine. The idea is we can take multiple servers, bliss, compute options
and chain them together to do lots of really, really cool things.
In this case, we took something out of the event grid, put it into our logic cap and ran in action against it. That does it for a demo hopeful that is really helpful and maybe conceptualizing some of these ideas. Let's go back to the slides and wrap this up.
Like I said, that does it for our service compute concepts coming up. Next, we're gonna take a look at some advanced networking concepts with an introduction toe application load balancing. See you in the next episode
Up Next