Time
7 hours 58 minutes
Difficulty
Intermediate
CEU/CPE
9

Video Transcription

00:00
Welcome back on this episode, we're gonna finish up our surveillance, compute concepts by taking a look and in a victory, a demo.
00:07
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.
00:13
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,
00:23
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
00:32
back in our eyes. Reporter, we're gonna walk through a demo of how we can incorporate event grid into a logic app.
00:39
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.
00:53
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.
01:03
Something has to trigger the logic app to occur.
01:06
And the first trigger I've chosen here is when a resource event occurs
01:11
and this resource event comes out of azure event grid.
01:15
Remember, as a raving cred is ingesting all of these changes that are occurring insider as your tenant.
01:23
If we expand this out, we can take a look at some of the properties we have set on it.
01:26
First, I've chosen a subscription that I want to monitor as well as a resource type. Here. I'm looking at resource groups,
01:34
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.
01:49
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.
02:02
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
02:16
going to go where to expression
02:19
and paste. In this expression,
02:23
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
02:44
based off the event grid trigger.
02:46
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.
03:05
Under this if true option, I've added an action to send an email.
03:12
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.
03:23
Let's take a look at what other options we have.
03:27
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.
03:47
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.
03:59
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.
04:19
One way to make a change is to change the hardware profile of the virtual machine.
04:27
Right now we're on a standard B one s
04:30
and I'm going to change it to a B two s.
04:34
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.
04:45
Our virgin machine is done being resized. So let's go back to our logic app.
04:53
And on our overview page we can see a summary,
04:58
and here we can see the runs history of every time this logic app has been triggered.
05:03
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.
05:25
Let me zoom out here just a little bit so we can fit it all on the screen.
05:31
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,
05:41
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.
05:51
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,
06:00
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.
06:11
Let's go back to our logic app
06:15
if we go back to when a resource event occurs.
06:20
If we look at our resource event trigger out of our event grid,
06:27
we can look at the raw output that came out of the event grid.
06:31
We scroll down to the bottom.
06:35
We're going to see in operation name here
06:38
for Microsoft. I compute slash virtual machines slash Right
06:43
now, let me go back to the logic app designer
06:47
and inside of our condition.
06:49
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
07:10
and send an email.
07:12
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.
07:23
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.
07:31
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
07:51
and chain them together to do lots of really, really cool things.
07:56
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.
08:11
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

AZ-300: Microsoft Azure Architect Technologies

Azure Solution Architects are responsible for taking business requirements and turning them into solutions. This course provides an introduction into Azure, Microsoft’s cloud platform.

Instructed By

Instructor Profile Image
Jeff Brown
Instructor