Lab 2: Configure Azure logic app to monitor changes to a resource group.
The main tasks for this exercise are as follows:
Add a trigger to the Azure logic app
Add an action to the Azure logic app
Identify the callback URL of the Azure logic app
Configure an event subscription
Test the logic app
Task 1: Add a trigger to the Azure logic app
In the the Azure portal, navigate to the Logic App Designer blade of the newly provisioned Azure logic app.
Click Blank Logic App. This will create a blank designer workspace and display a list of connectors and triggers to add to the workspace.
Search for Event Grid triggers and, in the list of results, click the When a resource event occurs Azure Event Grid trigger to add it to the designer workspace.
In the Azure Event Grid tile, click the Connect with Service Principal link, specify the following values, and click Create:
Connection Name: egc30007
Client ID: the ApplicationId property you identified in the previous exercise
Client Secret: Pa55w.rd1234
Tenant: the TenantId property you identified in the previous exercise
In the When a resource event occurs tile, specify the following values:
Subscription: the subscription Id property you identified in the previous exercise
Resource Type: Microsoft.Resources.resourceGroups
Resource Name: az3000701-LabRG
Event Type Item - 1: Microsoft.Resources.ResourceWriteSuccess
Event Type Item - 2: Microsoft.Resources.ResourceDeleteSuccess
Click Add new parameter and select Subscription Name
In the Subscription Name text box, type event-subscription-az3000701 and click Save.
Task 2: Add an action to the Azure logic app
In the the Azure portal, on the Logic App Designer blade of the newly provisioned Azure logic app, click + New step.
In the Choose an action pane, in the Search connectors and actions text box, type Outlook.
In the list of results, click Outlook.com.
In the list of actions for Outlook.com, click Send an email.
In the Outlook.com pane, click Sign in.
When prompted, authenticate by using the Microsoft Account you are using in this lab.
When prompted for the consent to grant Azure Logic App permissions to access Outlook resources, click Yes.
In the Send an email pane, specify the following settings and click Save:
To: the primary e-mail address of your Microsoft Account
Subject: type Resource updated: and, in the Dynamic Content column to the right of the Send an email pane, click Subject.
Body: type Resource group:, in the Dynamic Content column to the right of the Send an email pane, click Topic, type Event type:, in the Dynamic Content column to the right of the Send an email pane, click Event Type, type Event ID:, in the Dynamic Content column to the right of the Send an email pane, click ID, type Event Time:, and in the Dynamic Content column to the right of the Send an email pane, click Event Time.
Task 3: Identify the callback URL of the Azure logic app
In the Azure portal, navigate to the logicapp3000701 blade and, in the Summary section, click See trigger history. Ignore any Forbidden error messages.
On the When_a_resource_event_occurs blade, copy the value of the Callback url [POST] text box.
Task 4: Configure an event subscription
In the Azure portal, navigate to the az3000701-LabRG resource group and, in the vertical menu, click Events.
On the az3000701-LabRG - Events blade, select Get Started and click Web Hook.
On the Create Event Subscription blade, in the Filter to Event Types drop down list, ensure that only the checkboxes next to the Resource Write Success and Resource Delete Success are selected.
In the Endpoint Type drop down list, ensure that Web Hook is selected and click the Select an endpoint link.
On the Select Web Hook blade, in the Subscriber Endpoint, paste the value of the Callback url [POST] of the Azure logic app you copied in the previous task and click Confirm Selection.
In the Name text box within the EVENT SUBSCRIPTION DETAILS section, type event-subscription-az3000701.
Click Create.
Task 5: Test the logic app
In the Azure portal, navigate to the az3000701-LabRG resource group and, in the vertical menu, click Overview.
In the list of resources, click the Azure storage account you created in the first exercise.
On the storage account blade, in the vertical menu, click Configuration.
On the configuration blade, set the Secure transfer required setting to Disabled and click Save
Navigate to the logicapp3000701 blade, click Refresh, and note that the Runs history includes the entry corresponding to configuration change of the Azure storage account.
Navigate to the inbox of the email account you configured in this exercise and verify that includes an email generated by the logic app.
Review
After you completed this exercise, you have configured an Azure logic app to monitor changes to a resource group.