Learning Path 8 - Lab 1 - Exercise 2 - Create a Scheduled Query from a template
Lab scenario
You’re a Security Operations Analyst working at a company that implemented Microsoft Sentinel. You must learn how to detect and mitigate threats using Microsoft Sentinel. After connecting your data sources to Microsoft Sentinel, you create custom analytics rules to help discover threats and anomalous behaviors in your environment.
Analytics rules search for specific events or sets of events across your environment, alert you when certain event thresholds or conditions are reached, generate incidents for your SOC to triage and investigate, and respond to threats with automated tracking and reMediation processes.
Important: The lab exercises for Learning Path #8 are in a standalone environment. If you exit the lab before completing it, you will be required to re-run the configurations again.
Estimated time to complete this lab: 45 minutes
Note: Microsoft Sentinel has been predeployed in your Azure subscription with the name sentinelworkspace-01, and the Azure Activity solution and data connector have been installed and connected.
Task 1: Create a Scheduled Query rule
In this task, you create a Microsoft Sentinel analytics scheduled query rule.
-
Log in to WIN1 virtual machine as Admin with the password: Pa55w.rd.
-
Open the Microsoft Edge browser.
-
In the Edge browser, navigate to Defender XDR at
https://security.microsoft.com. -
In the Sign in dialog box, copy, and paste in the Tenant Email account provided by your lab hosting provider and then select Next.
-
In the Enter password dialog box, copy, and paste in the Tenant Password provided by your lab hosting provider and then select Sign in.
Note: You may be prompted to enter the Temporary Access Pass (TAP) instead of a password. This is also provided in the resources tab. If prompted, copy and paste the TAP value and select Sign in.
-
In the Microsoft Defender navigation menu, scroll down and expand the Microsoft Sentinel section.
-
Expand the Configuration section and select Analytics.
-
Make sure that you are in the Rule templates tab in the command bar and search for the New CloudShell User rule.
-
From the rule summary blade, make sure you’re receiving data by reviewing the green icon under Data sources: Azure Activity.
Note: If you do not see it in a connected state, and you ran the Prerequisite task above, you may need to wait longer for the process to complete.
-
Select Create rule to continue.
-
In the Analytics rule wizard, on the General tab, change the Severity to Medium.
-
Select Next: Set rule logic > button:
-
For the rule query, select View query results. You shouldn’t receive any results nor any errors.
-
Close the Logs window by selecting the upper right X and select OK to discard to save changes to go back to the wizard.
-
Scroll down and under Query scheduling set the following:
Setting Value Run Query every 5 minutes Lookup data from the last 1 Days Note: We are purposely generating many incidents for the same data. This enables the Lab to use these alerts.
-
Under the Alert threshold area, leave the value unchanged since we want the alert to register every event.
-
Under the Event grouping area, leave the Group all events into a single alert as the selected option since we want to generate a single alert every time it runs, as long as the query returns more results than the specified alert threshold above.
-
Select the Next: Incident settings > button.
-
On the Incident settings tab, review the default options.
-
Select the Next: Automated response > button.
-
Select the Next: Review and create > button.
-
Select Save.
Task 2: Edit your new rule
-
In the Microsoft Defender navigation menu, scroll down and expand the Microsoft Sentinel section.
-
Expand the Configuration section and select Analytics.
-
Make sure that you are in the Active rules tab in the command bar and select the New CloudShell User rule.
-
Right click the rule and select Edit from the pop-up menu.
-
Select the Next: Set rule logic > button.
-
Select the Next: Incident settings > button.
-
Select the Next: Automated response > button.
-
On the Automated response tab under Automation rules, select + Add new.
-
For the Automation rule name, enter Tier 2.
-
For the Actions, select Assign owner.
-
Then select Assign to me.
-
Select Apply
-
Select the Next: Review and create > button.
-
Select Save.
Task 3: Test your new rule
In this task, you test your new scheduled query rule. You start by enabling Cloud Shell in the Azure portal, which will trigger the rule you created in the previous task and generate an incident.
-
In the Microsoft Edge browser, navigate to the Azure portal at
https://portal.azure.com. -
In the Sign in dialog box, copy, and paste in the Tenant Email account provided by your lab hosting provider and then select Next.
-
In the Enter password dialog box, copy, and paste in the Tenant Password provided by your lab hosting provider and then select Sign in.
Note: You may be prompted to enter the Temporary Access Pass (TAP) instead of a password. This is also provided in the resources tab. If prompted, copy and paste the TAP value and select Sign in.
-
On the menu bar of the Azure portal, Select the icon >_ that corresponds to Cloud Shell. You might need to select the ellipsis icon first (…) if your display resolution is too low.
-
In the Welcome to Azure Cloud Shell window, select Powershell.
-
On the Getting started page, select Mount storage account, and then select your _XXXXXXXXX-MicrosoftSentinelLabs from the storage account subscription drop-down menu item and select the Apply button.
Important: Do not select the No storage account required radio button option. This wil cause the incident creation to fail.
-
On the Mount storage account page, select We will create a storage account for you, and then select Next.
-
Wait until the Cloud Shell is provisioned, then close the Azure Cloud Shell window.
-
In the Search bar of the Azure portal, type Activity and then select Activity Log.
-
Make sure the following Operation name items appear: List Storage Account Keys and Update Storage Account Create. These are the operations that the KQL query you reviewed earlier will match to generate the alert. Hint: You might need to select Refresh to update the list.
-
Return to Defender XDR at
https://security.microsoft.com. -
In the Microsoft Defender navigation menu, scroll down and expand the Investigation & response section. Next,expand the Incidents & alerts section and select Incidents.
-
You should see the newly created Incident.
Note: The event that triggers the incident may take 5+ minutes to process. Continue with the next exercise, you will come back to this view later.
-
Select the Incident and review the information in the right blade.