Home

Sign in risk alert and playbook

%3CLINGO-SUB%20id%3D%22lingo-sub-386933%22%20slang%3D%22en-US%22%3ESign%20in%20risk%20alert%20and%20playbook%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-386933%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20running%20into%20some%20issues%20with%20an%20alert%20I%20am%20trying%20to%20build%20and%20I%20wonder%20if%20anyone%20else%20has%20come%20across%20this.%26nbsp%3B%20I%20have%20an%20alert%20rule%20with%20the%20following%20query%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESecurityAlert%3CBR%20%2F%3E%7C%20where%20TimeGenerated%20%26gt%3B%20ago(30m)%3CBR%20%2F%3E%7C%20where%20AlertName%20%3D%3D%20%22Unfamiliar%20sign-in%20properties%22%3CBR%20%2F%3E%7C%20extend%20Extprop%20%3D%20parsejson(ExtendedProperties)%3CBR%20%2F%3E%7C%20extend%20UserPrincipalName%20%3D%20Extprop%5B%22User%20Account%22%5D%3CBR%20%2F%3E%7C%20extend%20IPAddress%20%3D%20Extprop%5B%22Client%20IP%20Address%22%5D%3CBR%20%2F%3E%7C%20extend%20Location%20%3D%20Extprop%5B%22Client%20Location%22%5D%3CBR%20%2F%3E%7C%20project%20AlertName%2CAlertType%2CTimeGenerated%2CUserPrincipalName%2CIPAddress%2CLocation%3CBR%20%2F%3E%7C%20extend%20AccountCustomEntity%20%3D%20UserPrincipalName%3CBR%20%2F%3E%7C%20extend%20IPCustomEntity%20%3D%20IPAddress%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHere%20are%20the%20problems%3A%3C%2FP%3E%3CP%3E1.%20When%20a%20case%20is%20created%2C%20it%20does%20not%20map%20the%20user%20principal%20name%20or%20the%20IP%20address%20to%20the%20case.%26nbsp%3B%20When%20building%20that%20alert%2C%20the%20drop%20down%20menu%20for%20these%20values%20did%20not%20show%20the%20selected%20fields%20as%20options.%3C%2FP%3E%3CP%3E2.%26nbsp%3BThe%20second%20problem%20is%20I%20think%20related%20to%20the%20first.%26nbsp%3B%20Once%20a%20case%20is%20created%20I%20tried%20creating%20a%20logic%20app%2Fplaybook%20that%20would%20email%20the%20details%20of%20the%20case%20to%20me%20and%20create%20a%20powershell%20command%20using%20output%20from%20the%20alert.%26nbsp%3B%20Because%20the%20entities%20like%20username%20and%20IP%20address%20didn%E2%80%99t%20map%20to%20the%20case%2C%20I%20can%E2%80%99t%20pull%20that%20in%20from%20the%20Sentinel%20Case%20that%20is%20defined%20in%20the%20trigger.%26nbsp%3B%20I%20was%20able%20to%20add%20a%20step%20to%20run%20a%20log%20query%20and%20then%20use%20the%20output%20in%20future%20steps.%26nbsp%3B%20This%20worked%20okay%20for%20testing%2C%20but%20the%20problem%20I%20see%20is%20that%20the%20query%20has%20a%20time%20limit.%26nbsp%3B%20Right%20now%20it%20is%20for%20all%20events%20generated%20within%2030%20minutes.%26nbsp%3B%20If%20the%20playbook%20is%20run%20more%20than%2030%20minutes%20after%20the%20alert%2C%20it%20won%E2%80%99t%20see%20it.%3C%2FP%3E%3CP%3E3.%26nbsp%3BI%20was%20able%20to%20use%20a%20data%20gateway%20to%20create%20a%20powershell%20script%20on%20a%20local%20server%20through%20the%20playbook.%26nbsp%3B%20The%20problem%20was%2C%20that%20the%20last%20few%20lines%20of%20the%20script%20add%20an%20A%20after%20each%20value.%26nbsp%3B%20I%20attached%20a%20screenshot.%26nbsp%3B%26nbsp%3BIf%20I%20change%20the%20file%20extension%20to%20.txt%20then%20it%20displays%20correctly%2C%20but%20then%20when%20I%20switch%20it%20back%20to%20.ps1%20the%20%E2%80%9CA%E2%80%9Ds%20are%20back.%26nbsp%3B%20This%20happens%20whether%20I%20create%20the%20file%20with%20dynamic%20values%20or%20not.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-390128%22%20slang%3D%22en-US%22%3ERe%3A%20Sign%20in%20risk%20alert%20and%20playbook%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-390128%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20Liza.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F306179%22%20target%3D%22_blank%22%3E%40andrew_bryant.%20%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EThank%20you%20for%20you%20feedback.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EYou%20are%20right.%20The%20team%20completed%20the%20work%20on%20adding%20actions%20to%20the%20Azure%20Sentinel%26nbsp%3Bconnector%20to%20allow%20customers%20to%20get%20the%20list%20of%20users%2C%20machines%26nbsp%3Band%20IP's%20so%20they%20can%20use%20them%20in%20as%20part%20of%20the%20playbooks%20exactly%26nbsp%3Blike%20you've%26nbsp%3Bmentioned.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EIt%20should%20be%20available%26nbsp%3Bin%20the%20designer%20in%201-2%20weeks.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-390102%22%20slang%3D%22en-US%22%3ERe%3A%20Sign%20in%20risk%20alert%20and%20playbook%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-390102%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F306179%22%20target%3D%22_blank%22%3E%40andrew_bryant%3C%2FA%3E%20%2C%20I'm%20adding%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F187254%22%20target%3D%22_blank%22%3E%40Koby%20Koren%3C%2FA%3E%20to%20help%20your%20issue%20with%20the%20playbooks%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-389680%22%20slang%3D%22en-US%22%3ERe%3A%20Sign%20in%20risk%20alert%20and%20playbook%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-389680%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F73142%22%20target%3D%22_blank%22%3E%40Liza%20Mash%20Levin%3C%2FA%3E%26nbsp%3Bthanks%20for%20that%20info.%26nbsp%3B%20The%20username%20is%20now%20showing%20up%20in%20the%20case.%26nbsp%3B%20However%2C%20when%20I%20go%20to%20the%20playbook%2Flogic%20app%20that%20is%20triggered%20by%20the%20Sentinel%20alert%2C%20it%20does%20not%20have%20the%20ability%20to%20pull%20the%20username%20in%20as%20dynamic%20content%20to%20a%20future%20step.%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESome%20things%20I%20am%20trying%20to%20accomplish%20with%20the%20playbook%20are%20to%20send%20an%20email%20alert%20that%20would%20contain%20the%20username%2C%20open%20a%20service%20now%20ticket%20that%20would%20contain%20the%20username%2C%20or%20create%20a%20powershell%20script%20to%20reset%20the%20user's%20password.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%2C%3C%2FP%3E%3CP%3EAndrew%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-388534%22%20slang%3D%22en-US%22%3ERe%3A%20Sign%20in%20risk%20alert%20and%20playbook%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-388534%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F306179%22%20target%3D%22_blank%22%3E%40andrew_bryant%3C%2FA%3E%20the%20entity%20extraction%20supports%20only%20string%20values%2C%20simply%20add%20tostring%20on%20the%20column%20you%20would%20want%20to%20map%20and%20this%20will%20work.%3C%2FP%3E%0A%3CP%3Ewe%20will%20add%20a%20warning%20in%20the%20UI%20to%20surface%20this%20issue%20to%20make%20sure%20the%20customers%20understand%20the%20route%20cause%20of%20this.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThanks%2C%3C%2FP%3E%0A%3CP%3ELiza%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-386972%22%20slang%3D%22en-US%22%3ERe%3A%20Sign%20in%20risk%20alert%20and%20playbook%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-386972%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F306179%22%20target%3D%22_blank%22%3E%40andrew_bryant%3C%2FA%3E%26nbsp%3B%20-%20can%20you%20please%20remove%20the%20extend%20fields%20and%20define%20them%20using%20the%20'Entity%20mapping'%20capability%3F%3C%2FP%3E%0A%3CP%3Efurthermore%20-%20can%20you%20please%20send%20me%20the%20alert%20ID%20(will%20be%20available%20once%20you%20try%20to%20edit%20the%20alert)%20and%20the%20workspace%20ID%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-386955%22%20slang%3D%22en-US%22%3ERe%3A%20Sign%20in%20risk%20alert%20and%20playbook%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-386955%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F306179%22%20target%3D%22_blank%22%3E%40andrew_bryant%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F73142%22%20target%3D%22_blank%22%3E%40Liza%20Mash%20Levin%3C%2FA%3E%3A%20Is%20this%20something%20you%20can%20speak%20to%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E(CC%3A%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F293879%22%20target%3D%22_blank%22%3E%40Ofer_Shezaf%3C%2FA%3E)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-474948%22%20slang%3D%22en-US%22%3ERe%3A%20Sign%20in%20risk%20alert%20and%20playbook%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-474948%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F73142%22%20target%3D%22_blank%22%3E%40Liza%20Mash%20Levin%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%20Liza%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHaving%20an%20issue%20with%20another%20alert.%26nbsp%3B%20Here%20is%20the%20query%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3ESecurityAlert%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20ProviderName%20%3D%3D%20%3C%2FSPAN%3E%3CSPAN%3E%22MCAS%22%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20TimeGenerated%20%26gt%3B%20ago(%3C%2FSPAN%3E%3CSPAN%3E15%3C%2FSPAN%3E%3CSPAN%3Em)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20AlertName%20%3D%3D%20%3C%2FSPAN%3E%3CSPAN%3E%22Impossible%20travel%20activity%22%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20Entities%20%3D%20todynamic(Entities)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Emvexpand%3C%2FSPAN%3E%3CSPAN%3E%20Entities%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eproject%3C%2FSPAN%3E%3CSPAN%3E%20AlertName%2C%20AlertSeverity%2C%20Entities%2C%20TimeGenerated%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eevaluate%3C%2FSPAN%3E%3CSPAN%3E%20bag_unpack(Entities)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20Type%20%3D%20columnifexists(%3C%2FSPAN%3E%3CSPAN%3E%22Type%22%3C%2FSPAN%3E%3CSPAN%3E%2C%20%3C%2FSPAN%3E%3CSPAN%3E%22%22%3C%2FSPAN%3E%3CSPAN%3E)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20Type%20in(%3C%2FSPAN%3E%3CSPAN%3E%22account%22%3C%2FSPAN%3E%3CSPAN%3E%2C%20%3C%2FSPAN%3E%3CSPAN%3E%22host%22%3C%2FSPAN%3E%3CSPAN%3E%2C%20%3C%2FSPAN%3E%3CSPAN%3E%22ip%22%3C%2FSPAN%3E%3CSPAN%3E)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Ewhere%3C%2FSPAN%3E%3CSPAN%3E%20Type%20%3D%3D%20%3C%2FSPAN%3E%3CSPAN%3E%22account%22%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EI%20want%20to%20map%20the%20cloumn%20Name%20to%20the%20AccountCustomEntity.%26nbsp%3B%20If%20I%20add%20this%20line%20in%20the%20log%20query%20it%20displays%20fine%3A%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3E%7C%20%3C%2FSPAN%3E%3CSPAN%3Eextend%3C%2FSPAN%3E%3CSPAN%3E%20AccountCustomEntity%20%3D%20tostring(Name)%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3EBut%20it%20will%20not%20allow%20me%20to%20save%20that%20in%20the%20alert%20rule.%26nbsp%3B%20It%20says%20query%20syntax%20error.%26nbsp%3B%20In%20fact%2C%20any%20attempt%20I%20make%20to%20add%20a%20line%20in%20the%20alert%20rule%20that%20uses%20the%20%22Name%22%20column%20gives%20me%20that%20error.%3C%2FSPAN%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E
andrew_bryant
Contributor

I am running into some issues with an alert I am trying to build and I wonder if anyone else has come across this.  I have an alert rule with the following query:

 

SecurityAlert
| where TimeGenerated > ago(30m)
| where AlertName == "Unfamiliar sign-in properties"
| extend Extprop = parsejson(ExtendedProperties)
| extend UserPrincipalName = Extprop["User Account"]
| extend IPAddress = Extprop["Client IP Address"]
| extend Location = Extprop["Client Location"]
| project AlertName,AlertType,TimeGenerated,UserPrincipalName,IPAddress,Location
| extend AccountCustomEntity = UserPrincipalName
| extend IPCustomEntity = IPAddress

 

Here are the problems:

1. When a case is created, it does not map the user principal name or the IP address to the case.  When building that alert, the drop down menu for these values did not show the selected fields as options.

2. The second problem is I think related to the first.  Once a case is created I tried creating a logic app/playbook that would email the details of the case to me and create a powershell command using output from the alert.  Because the entities like username and IP address didn’t map to the case, I can’t pull that in from the Sentinel Case that is defined in the trigger.  I was able to add a step to run a log query and then use the output in future steps.  This worked okay for testing, but the problem I see is that the query has a time limit.  Right now it is for all events generated within 30 minutes.  If the playbook is run more than 30 minutes after the alert, it won’t see it.

3. I was able to use a data gateway to create a powershell script on a local server through the playbook.  The problem was, that the last few lines of the script add an A after each value.  I attached a screenshot.  If I change the file extension to .txt then it displays correctly, but then when I switch it back to .ps1 the “A”s are back.  This happens whether I create the file with dynamic values or not.

 

7 Replies

@andrew_bryant 

 

@Liza Mash Levin: Is this something you can speak to?

 

(CC: @Ofer_Shezaf)

@andrew_bryant  - can you please remove the extend fields and define them using the 'Entity mapping' capability?

furthermore - can you please send me the alert ID (will be available once you try to edit the alert) and the workspace ID?

@andrew_bryant the entity extraction supports only string values, simply add tostring on the column you would want to map and this will work.

we will add a warning in the UI to surface this issue to make sure the customers understand the route cause of this.

 

Thanks,

Liza

@Liza Mash Levin thanks for that info.  The username is now showing up in the case.  However, when I go to the playbook/logic app that is triggered by the Sentinel alert, it does not have the ability to pull the username in as dynamic content to a future step.  

 

Some things I am trying to accomplish with the playbook are to send an email alert that would contain the username, open a service now ticket that would contain the username, or create a powershell script to reset the user's password.

 

Thanks,

Andrew

@andrew_bryant , I'm adding @Koby Koren to help your issue with the playbooks

Thanks Liza.

 

Hi @andrew_bryant.

Thank you for you feedback.

 

You are right. The team completed the work on adding actions to the Azure Sentinel connector to allow customers to get the list of users, machines and IP's so they can use them in as part of the playbooks exactly like you've mentioned.

It should be available in the designer in 1-2 weeks.

@Liza Mash Levin 

Hi Liza,

 

Having an issue with another alert.  Here is the query:

 

SecurityAlert
| where ProviderName == "MCAS"
| where TimeGenerated > ago(15m)
| where AlertName == "Impossible travel activity"
| extend Entities = todynamic(Entities)
| mvexpand Entities
| project AlertName, AlertSeverity, Entities, TimeGenerated
| evaluate bag_unpack(Entities)
| extend Type = columnifexists("Type", "")
| where Type in("account", "host", "ip")
| where Type == "account"
 
I want to map the cloumn Name to the AccountCustomEntity.  If I add this line in the log query it displays fine:
| extend AccountCustomEntity = tostring(Name)
 
But it will not allow me to save that in the alert rule.  It says query syntax error.  In fact, any attempt I make to add a line in the alert rule that uses the "Name" column gives me that error.
Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
46 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
29 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies