Home
%3CLINGO-SUB%20id%3D%22lingo-sub-745025%22%20slang%3D%22en-US%22%3EFailed%20Login%20Report%20Using%20Log%20Analytics%20and%20Logic%20Apps%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-745025%22%20slang%3D%22en-US%22%3E%3CP%20class%3D%22MsoNormal%22%3EMy%20name%20is%20Brad%20Watts%20and%20I%E2%80%99m%20a%20SCOM%20PFE.%20I%20wanted%20to%20take%20a%20little%20bit%20of%20time%20to%20demonstrate%20how%20you%20can%20use%20Azure%20Log%20Analytics%20along%20with%20Azure%20Logic%20Apps%20to%20email%20out%20reports%20on%20important%20information.%20In%20this%20blog%20we%20will%20create%20a%20report%20of%20failed%20login%20attempts%20across%20all%20our%20monitored%20%3CSPAN%20class%3D%22GramE%22%3Eservers%3C%2FSPAN%3Ebut%20this%20is%20just%20the%20tip%20of%20the%20ice%20berg%20of%20the%20useful%20information%20you%20can%20get%20from%20Log%20Analytics.%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3EBefore%20I%20show%20you%20how%20to%20build%20this%20solution%2C%20lets%20briefly%20talk%20about%20Log%20Analytics%20and%20Logic%20Apps.%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1791570011%22%20id%3D%22toc-hId-1791570012%22%3ELog%20Analytics%3C%2FH2%3E%0A%3CP%20class%3D%22MsoNormal%22%3ELog%20Analytics%20falls%20under%20the%20umbrella%20of%20Azure%20Monitor%20and%20provides%20a%20repository%20of%20data%20that%20is%20queries%20using%20the%20Kusto%20Query%20Language.%20Typically%2C%20data%20is%20inserted%20into%20Log%20Analytics%20using%20an%20agent%20that%20can%20be%20added%20directly%20in%20Azure%2C%20using%20your%20System%20Center%20Operations%20Manager%20environment%2C%20or%20manually%20installing%20the%20agent.%20You%20can%20configure%20a%20Log%20Analytics%20Workspace%20to%20collect%20event%20logs%2C%20performance%20data%2C%20log%20files%2C%20etc.%20You%20can%20also%20implement%20Monitoring%20Solutions%20such%20as%20the%20%E2%80%9CUpdate%20Compliance%E2%80%9D%20solution%20to%20collect%20additional%20information.%20For%20our%20example%20we%20are%20wanting%20to%20report%20on%20failed%20logins%20which%20come%20from%20the%20Security%20event%20log%20so%20we%20must%20have%20implemented%20Azure%20Security%20Center%20for%20this%20information%20to%20be%20available.%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3EGoing%20in%20depth%20on%20Security%20Center%20or%20Azure%20Monitor%20is%20beyond%20the%20scope%20of%20this%20blog%20but%20if%20you%E2%80%99re%20interested%20then%20happy%20reading!%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-monitor%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-monitor%2F%3C%2FA%3E%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fsecurity-center%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fsecurity-center%2F%3C%2FA%3E%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--760586950%22%20id%3D%22toc-hId--760586949%22%3ELogic%20Apps%3C%2FH2%3E%0A%3CP%20class%3D%22MsoNormal%22%3ELogic%20Apps%20provides%20a%20graphical%20interface%20to%20run%20a%20workflow%20that%20integrates%20different%20components%20together.%20There%20is%20an%20amazing%20number%20of%20products%20that%20Logic%20Apps%20integrates%20with.%20For%20our%20example%20we%20will%20first%20connect%20to%20a%20Log%20Analytics%20Workspace%2C%20run%20a%20Kusto%20Query%2C%20and%20then%20email%20the%20alerts%20using%20Office%20365.%20We%20could%20have%20just%20as%20easily%20sent%20the%20results%20to%20Google%20Mail%20or%20a%20slack%20channel.%20If%20you%E2%80%99re%20interested%20in%20the%20connectors%20available%20in%20Logic%20Apps%20%3CSPAN%20class%3D%22GramE%22%3Etake%20a%20look%3C%2FSPAN%3Eat%20the%20following%20link%3A%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fconnectors%2Fapis-list%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fconnectors%2Fapis-list%3C%2FA%3E%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3EIf%20you%E2%80%99re%20interested%20in%20detail%20documentation%20on%20the%20product%20%3CSPAN%20class%3D%22GramE%22%3Ehere%3C%2FSPAN%3Eyou%20go!%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Flogic-apps%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Flogic-apps%2F%3C%2FA%3E%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-982223385%22%20id%3D%22toc-hId-982223386%22%3EExample%20Solution%3C%2FH2%3E%0A%3CP%20class%3D%22MsoNormal%22%3EI%E2%80%99m%20going%20to%20walk%20through%20creating%20a%20report%20that%20is%20sent%20out%20once%20a%20day.%20For%20this%20walkthrough%20we%20will%20use%20Log%20Analytics%20to%20pull%20a%20list%20of%20failed%20logins%20by%20computer%2C%20format%20it%20into%20a%20HTML%20file%2C%20and%20attach%20that%20result%20to%20an%20email.%20To%20accomplish%20this%2C%20we%20need%20to%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%20class%3D%22MsoNormal%22%3ECreate%20the%20Kusto%20Query%20that%20can%20pull%20this%20information%3C%2FLI%3E%0A%3CLI%20class%3D%22MsoNormal%22%3EDesign%20a%20Logic%20Apps%20job%20to%20schedule%20the%20query%20and%20then%20email%20the%20results%20out%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CH3%20id%3D%22toc-hId--1766447081%22%20id%3D%22toc-hId--1766447080%22%3E%26nbsp%3B%3C%2FH3%3E%0A%3CH3%20id%3D%22toc-hId--23636746%22%20id%3D%22toc-hId--23636745%22%3ECreating%20the%20Kusto%20Query%3C%2FH3%3E%0A%3CP%20class%3D%22MsoNormal%22%3EIn%20this%20scenario%20we%20already%20have%20an%20Azure%20Log%20Analytics%20Workspace%20and%20Security%20Center%20enabled%20and%20reporting%20to%20our%20workspace%20with%20the%20proper%20agents%20deployed.%20To%20start%20with%20open%20the%20Log%20Analytics%20Workspace%20and%20open%20%E2%80%9CLogs%E2%80%9D%20to%20start%20your%20Kusto%20query.%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%3CSPAN%20style%3D%22mso-no-proof%3A%20yes%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20497px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F122715i6FF5F1CEC04308EE%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image001.png%22%20title%3D%22image001.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3EFirst%20thing%20we%20need%20to%20do%20is%20pull%20from%20the%20correct%20data%20source.%20Whenever%20you%20are%20using%20Security%20Center%20(which%20included%20the%20Security%20Event%20Log)%20then%20we%20need%20to%20get%20information%20from%20%3CSPAN%20class%3D%22SpellE%22%3ESecurityEvent%3C%2FSPAN%3E.%20%3CSPAN%20class%3D%22GramE%22%3ESo%3C%2FSPAN%3Eour%20query%20will%20start%20with%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%3CSPAN%20style%3D%22mso-tab-count%3A%201%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22SpellE%22%3ESecurityEvent%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%3CSPAN%20class%3D%22GramE%22%3ENext%3C%2FSPAN%3Ewe%20need%20to%20start%20filtering%20the%20data.%20You%20should%20always%20filter%20the%20data%2Ftime%20first%20so%20we%20will%20pull%20the%20last%2024%20hours%20using%20ago(1d).%20%3CSPAN%20class%3D%22GramE%22%3ESo%3C%2FSPAN%3Eour%20query%20will%20now%20look%20like%20this%3A%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%20style%3D%22margin-bottom%3A%20.0001pt%3B%20line-height%3A%20normal%3B%22%3E%3CSPAN%20style%3D%22mso-tab-count%3A%201%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22SpellE%22%3ESecurityEvent%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%20style%3D%22margin-bottom%3A%20.0001pt%3B%20line-height%3A%20normal%3B%22%3E%3CSPAN%20style%3D%22mso-tab-count%3A%201%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%7C%20where%20%3CSPAN%20class%3D%22SpellE%22%3ETimeGenerated%3C%2FSPAN%3E%26gt%3B%3D%20ago(1d)%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%20style%3D%22margin-bottom%3A%20.0001pt%3B%20line-height%3A%20normal%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%3CSPAN%20class%3D%22GramE%22%3ENext%3C%2FSPAN%3Ewe%20will%20filter%20down%20to%20failed%20logins%20using%20Event%20Id%204625.%20Now%20our%20query%20looks%20like%20this%3A%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%20style%3D%22margin-bottom%3A%20.0001pt%3B%20line-height%3A%20normal%3B%22%3E%3CSPAN%20style%3D%22mso-tab-count%3A%201%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22SpellE%22%3ESecurityEvent%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%20style%3D%22margin-bottom%3A%20.0001pt%3B%20line-height%3A%20normal%3B%22%3E%3CSPAN%20style%3D%22mso-tab-count%3A%201%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%7C%20where%20%3CSPAN%20class%3D%22SpellE%22%3ETimeGenerated%3C%2FSPAN%3E%26gt%3B%3D%20ago(1d)%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%20style%3D%22margin-bottom%3A%20.0001pt%3B%20line-height%3A%20normal%3B%22%3E%3CSPAN%20style%3D%22mso-tab-count%3A%201%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%7C%20where%20EventID%20%3D%3D%204625%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3EIf%20you%20run%20this%20query%20you%20will%20get%20all%20the%20details%20on%20each%20failed%20login%3A%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%3CSPAN%20style%3D%22mso-no-proof%3A%20yes%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F122716i8DD18D063FFF5873%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image003.png%22%20title%3D%22image003.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3EBut%20our%20%3CSPAN%20class%3D%22GramE%22%3Efinal%20result%3C%2FSPAN%3Ewe%20want%20to%20summarize%20the%20number%20of%20failed%20logins%20for%20each%20unique%20Account%20Name%20and%20Computer%20combination.%20To%20do%20this%20we%20can%20add%20a%20summarize%20statement%20as%20follows%3A%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%20style%3D%22margin-bottom%3A%20.0001pt%3B%20line-height%3A%20normal%3B%22%3E%3CSPAN%20style%3D%22mso-tab-count%3A%201%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22mso-spacerun%3A%20yes%3B%22%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20style%3D%22mso-spacerun%3A%20yes%3B%22%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20class%3D%22SpellE%22%3ESecurityEvent%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%20style%3D%22margin-bottom%3A%20.0001pt%3B%20line-height%3A%20normal%3B%22%3E%3CSPAN%20style%3D%22mso-tab-count%3A%201%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%7C%20where%20%3CSPAN%20class%3D%22SpellE%22%3ETimeGenerated%3C%2FSPAN%3E%26gt%3B%3D%20ago(1d)%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%20style%3D%22margin-bottom%3A%20.0001pt%3B%20line-height%3A%20normal%3B%22%3E%3CSPAN%20style%3D%22mso-tab-count%3A%201%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%7C%20where%20EventID%20%3D%3D%204625%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%20style%3D%22margin-bottom%3A%20.0001pt%3B%20line-height%3A%20normal%3B%22%3E%3CSPAN%20style%3D%22mso-tab-count%3A%201%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%7C%20summarize%20%3CSPAN%20class%3D%22SpellE%22%3EFailedLogins%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22GramE%22%3Ecount(%3C%2FSPAN%3E)%20by%20%3CSPAN%20class%3D%22SpellE%22%3EAccount%2CComputer%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%20style%3D%22margin-bottom%3A%20.0001pt%3B%20line-height%3A%20normal%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3EThis%20gives%20us%20the%20information%20we%20want%20but%20it%20would%20be%20nice%20to%20order%20by%20the%20number%20of%20failed%20logins.%20We%20can%20add%20a%20sort%20by%20%3CSPAN%20class%3D%22SpellE%22%3EFailedLogins%3C%2FSPAN%3Edesc%20at%20the%20end%20of%20our%20query.%20The%20final%20query%20should%20look%20like%20this%3A%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%20style%3D%22margin-bottom%3A%20.0001pt%3B%20line-height%3A%20normal%3B%22%3E%3CSPAN%20style%3D%22mso-tab-count%3A%201%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%20class%3D%22SpellE%22%3ESecurityEvent%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%20style%3D%22margin-bottom%3A%20.0001pt%3B%20line-height%3A%20normal%3B%22%3E%3CSPAN%20style%3D%22mso-tab-count%3A%201%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%7C%20where%20%3CSPAN%20class%3D%22SpellE%22%3ETimeGenerated%3C%2FSPAN%3E%26gt%3B%3D%20ago(1d)%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%20style%3D%22margin-bottom%3A%20.0001pt%3B%20line-height%3A%20normal%3B%22%3E%3CSPAN%20style%3D%22mso-tab-count%3A%201%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%7C%20where%20EventID%20%3D%3D%204625%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%20style%3D%22margin-bottom%3A%20.0001pt%3B%20line-height%3A%20normal%3B%22%3E%3CSPAN%20style%3D%22mso-tab-count%3A%201%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%7C%20summarize%20%3CSPAN%20class%3D%22SpellE%22%3EFailedLogins%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22GramE%22%3Ecount(%3C%2FSPAN%3E)%20by%20%3CSPAN%20class%3D%22SpellE%22%3EAccount%2CComputer%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%20style%3D%22margin-bottom%3A%20.0001pt%3B%20line-height%3A%20normal%3B%22%3E%3CSPAN%20style%3D%22mso-tab-count%3A%201%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3E%7C%20sort%20by%20%3CSPAN%20class%3D%22SpellE%22%3EFailedLogins%3C%2FSPAN%3Edesc%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3EThe%20results%20should%20be%20a%20table%20with%20the%20results%20we%20would%20like%20to%20email%20out.%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%3CSPAN%20style%3D%22mso-no-proof%3A%20yes%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20797px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F122717i88215231FD75801D%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image005.png%22%20title%3D%22image005.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-1719173589%22%20id%3D%22toc-hId-1719173590%22%3ELogic%20Apps%3C%2FH3%3E%0A%3CP%20class%3D%22MsoNormal%22%3ENow%20we%20need%20to%20move%20over%20to%20Logic%20Apps%20to%20build%20the%20logic%20that%20will%20email%20out%20the%20above%20results.%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3EIn%20Azure%20Logic%20Apps%20we%E2%80%99ll%20start%20by%20clicking%20%E2%80%9CAdd%E2%80%9D%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%3CSPAN%20style%3D%22mso-no-proof%3A%20yes%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20356px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F122719i225D272C93199657%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image007.png%22%20title%3D%22image007.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3EGive%20it%20a%20descriptive%20name%20like%20%E2%80%98Daily-Failed-Login-Report%E2%80%99%20and%20hit%20create%20to%20get%20started.%20Start%20designing%20your%20solution%20by%20going%20to%20%E2%80%9CLogic%20app%20designer%E2%80%9D%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%3CSPAN%20style%3D%22mso-no-proof%3A%20yes%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20501px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F122720i3F4AD6D0BAC6DC5F%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image009.png%22%20title%3D%22image009.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3EOur%20solution%20is%20triggered%20off%20a%20schedule%20(once%20a%20day)%20so%20we%20can%20start%20with%20the%20template%20%E2%80%9CRecurrence%E2%80%9D%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%3CSPAN%20style%3D%22mso-no-proof%3A%20yes%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20796px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F122721iF72BCDBEF2BB90DC%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image011.png%22%20title%3D%22image011.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3EChange%20the%20recurrence%20to%20once%20per%20day%20and%20click%20on%20%E2%80%9C%2B%20New%20step%E2%80%9D%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%3CSPAN%20style%3D%22mso-no-proof%3A%20yes%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F122722iF74820109E79E108%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image013.png%22%20title%3D%22image013.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3ESearch%20for%20%E2%80%9CLog%20Analytics%E2%80%9D%20and%20choose%20%E2%80%9CRun%20query%20and%20visualize%20results%20(preview)%E2%80%9D%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%3CSPAN%20style%3D%22mso-no-proof%3A%20yes%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F122724iAD8CF7E6483893E3%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image015.png%22%20title%3D%22image015.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3EClick%20on%20%E2%80%9CSign%20in%E2%80%9D%20to%20log%20into%20Azure%20and%20select%20the%20Azure%20Log%20Analytics%20Workspace%20you%20want%20to%20query.%20Note%20that%20you%20might%20want%20to%20use%20a%20service%20principle%20to%20connect%20instead%20of%20a%20standard%20AAD%20account.%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3EOnce%20you%20sign%20%3CSPAN%20class%3D%22GramE%22%3Ein%3C%2FSPAN%3Eyou%E2%80%99ll%20need%20to%20provide%20the%20following%20information%3A%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%20style%3D%22margin-bottom%3A%20.0001pt%3B%20line-height%3A%20normal%3B%22%3E%3CSPAN%20style%3D%22mso-tab-count%3A%201%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3ESubscription%3A%20Azure%20Subscription%20where%20the%20Log%20Analytics%20Workspace%20is%20located%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%20style%3D%22margin-bottom%3A%20.0001pt%3B%20line-height%3A%20normal%3B%22%3E%3CSPAN%20style%3D%22mso-tab-count%3A%201%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3EResource%20Group%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%20style%3D%22margin-bottom%3A%20.0001pt%3B%20line-height%3A%20normal%3B%22%3E%3CSPAN%20style%3D%22mso-tab-count%3A%201%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3EWorkspace%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%20style%3D%22margin-bottom%3A%20.0001pt%3B%20line-height%3A%20normal%3B%22%3E%3CSPAN%20style%3D%22mso-tab-count%3A%201%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3EQuery%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%20style%3D%22margin-bottom%3A%20.0001pt%3B%20line-height%3A%20normal%3B%22%3E%3CSPAN%20style%3D%22mso-tab-count%3A%201%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3EChart%20Type%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F122725i49AE280AA5779531%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image017.png%22%20title%3D%22image017.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3EOnce%20you%20have%20this%20filled%20out%20click%20on%20the%20%E2%80%9C%2B%20New%20Step%E2%80%9D%20below%20your%20%E2%80%9CRun%20query%20and%20visualize%E2%80%9D%20activity.%20Search%20for%20%E2%80%9COffice%20365%E2%80%9D%20and%20choose%20%E2%80%9COffice%20365%20Outlook.%E2%80%9D%20We%20can%20choose%20either%20%E2%80%9CSend%20an%20email%20(V2)%20(preview)%E2%80%9D%20or%20%E2%80%9CSend%20an%20email%20from%20a%20shared%20mailbox%20(preview).%E2%80%9D%20In%20this%20case%20because%20I%20don%E2%80%99t%20have%20a%20shared%20mailbox%20to%20%3CSPAN%20class%3D%22GramE%22%3Euse%3C%2FSPAN%3EI%E2%80%99ll%20choose%20the%20first%20option.%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20608px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F122726i590586724B013D99%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image019.png%22%20title%3D%22image019.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3ESign%20into%20your%20Office%20365%20account%20to%20get%20started.%20Fill%20out%20the%20information%20that%20you%20want%20for%3A%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%3CSPAN%20style%3D%22mso-tab-count%3A%201%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3ETo%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%3CSPAN%20style%3D%22mso-tab-count%3A%201%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3ESubject%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%3CSPAN%20style%3D%22mso-tab-count%3A%201%3B%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%3C%2FSPAN%3EBody%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%3CSPAN%20style%3D%22mso-no-proof%3A%20yes%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F122727i1C05A1185F1A37F2%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image021.png%22%20title%3D%22image021.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3EThe%20last%20step%20is%20to%20add%20the%20HTML%20table%20from%20our%20Kusto%20query%20as%20an%20attachment.%20Drop%20down%20on%20the%20%E2%80%9CAdd%20new%20parameter%E2%80%9D%20option%20and%20select%20%E2%80%9CAttachments%E2%80%9D%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%3CSPAN%20style%3D%22mso-no-proof%3A%20yes%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F122728i63E0CC1BDE96314E%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image023.png%22%20title%3D%22image023.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3EThis%20will%20supply%20you%20with%20two%20new%20fields%20to%20fill%20out.%20The%20attachment%20name%20and%20attachment%20content.%20We%20want%20to%20use%20the%20data%20from%20the%20previous%20step.%20First%20click%20in%20the%20box%20for%20the%20%E2%80%9CAttachment%20Name.%E2%80%9D%20This%20will%20bring%20up%20a%20window%20on%20the%20%3CSPAN%20class%3D%22GramE%22%3Eright%20hand%3C%2FSPAN%3Eside%20where%20you%20can%20select%20dynamic%20data.%20In%20this%20case%20we%20only%20had%20one%20previous%20step%20which%20was%20to%20run%20the%20query.%20So%20under%20%E2%80%9CRun%20query%20and%20visualize%20results%E2%80%9D%20choose%20%E2%80%9CAttachment%20Name%E2%80%9D%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%3CSPAN%20style%3D%22mso-no-proof%3A%20yes%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F122729iAA674FBBF374D3E4%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image025.png%22%20title%3D%22image025.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3EClick%20in%20%E2%80%9CAttachment%20Content%E2%80%9D%20and%20this%20time%20choose%20%E2%80%9CAttachment%20Name.%E2%80%9D%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3EThat%E2%80%99s%20it!%20We%20need%20to%20first%20click%20on%20%E2%80%9CSave%E2%80%9D%20to%20commit%20our%20changes.%20After%20the%20save%20is%20%3CSPAN%20class%3D%22GramE%22%3Ecomplete%3C%2FSPAN%3Ewe%20can%20click%20on%20the%20%E2%80%9CRun%E2%80%9D%20option%20to%20test%20our%20solution.%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%3CSPAN%20style%3D%22mso-no-proof%3A%20yes%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20267px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F122730i869EA95BEC7E043D%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image027.png%22%20title%3D%22image027.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3EYou%20should%20get%20an%20email%20soon%20after%20with%20an%20attachment%20that%20looks%20something%20like%20the%20following%3A%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%3CSPAN%20style%3D%22mso-no-proof%3A%20yes%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20813px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F122731i62D99457ABD9C064%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image029.png%22%20title%3D%22image029.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--636469867%22%20id%3D%22toc-hId--636469866%22%3ESummary%3C%2FH2%3E%0A%3CP%20class%3D%22MsoNormal%22%3EAzure%20Log%20Analytics%20is%20a%20powerful%20tool%20that%20allows%20you%20to%20gather%20a%20lot%20of%20data%20from%20all%20sorts%20of%20sources.%20The%20Kusto%20Query%20Language%20allows%20us%20to%20quickly%20access%20that%20data%20and%20determine%20trends%20and%20visualize%20the%20data.%20We%20walked%20through%20an%20easy%20way%20to%20utilize%20this%20power%20by%20scheduling%20a%20report%20using%20Azure%20Logic%20Apps.%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3ETypically%2C%20any%20time%20you%20have%20a%20Kusto%20query%20that%20provides%20useful%20information%20you%20need%20to%20decide%20how%20to%20surface%20the%20data.%20The%20most%20common%20method%20to%20do%20this%20is%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%20class%3D%22MsoNormal%22%3ECreate%20a%20view%2Fdashboard%20using%20Log%20Analytics%3C%2FLI%3E%0A%3CLI%20class%3D%22MsoNormal%22%3ECreate%20an%20alert%20that%20shows%20under%20the%20Unified%20Alerting%20experience%20in%20Azure%20Monitor%3C%2FLI%3E%0A%3CLI%20class%3D%22MsoNormal%22%3ESchedule%20the%20data%20to%20be%20delivered%20through%20Logic%20Apps.%20This%20could%20be%20through%20email%20like%20in%20this%20example%20or%20some%20other%20medium%20(SharePoint%20Document%20Library%2C%20Slack%20Channel%2C%20%3CSPAN%20class%3D%22GramE%22%3Eetc..%3C%2FSPAN%3E)%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3EI%20hope%20you%20enjoyed%20this%20walkthrough%20and%20see%20how%20you%20can%20utilize%20this%20in%20the%20future!%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20class%3D%22MsoNormal%22%3EBrad%20Watts%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-745025%22%20slang%3D%22en-US%22%3E%3CP%3EMy%20name%20is%20Brad%20Watts%20and%20I%E2%80%99m%20a%20SCOM%20PFE.%20I%20wanted%20to%20take%20a%20little%20bit%20of%20time%20to%20demonstrate%20how%20you%20can%20use%20Azure%20Log%20Analytics%20along%20with%20Azure%20Logic%20Apps%20to%20email%20out%20reports%20on%20important%20information.%20In%20this%20blog%20we%20will%20create%20a%20report%20of%20failed%20login%20attempts%20across%20all%20our%20monitored%20%3CSPAN%3Eservers%3C%2FSPAN%3Ebut%20this%20is%20just%20the%20tip%20of%20the%20ice%20berg%20of%20the%20useful%20information%20you%20can%20get%20from%20Log%20Analytics.%3C%2FP%3E%0A%3CP%3EBefore%20I%20show%20you%20how%20to%20build%20this%20solution%2C%20lets%20briefly%20talk%20about%20Log%20Analytics%20and%20Logic%20Apps.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-745025%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EBradWatts%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

My name is Brad Watts and I’m a SCOM PFE. I wanted to take a little bit of time to demonstrate how you can use Azure Log Analytics along with Azure Logic Apps to email out reports on important information. In this blog we will create a report of failed login attempts across all our monitored servers but this is just the tip of the ice berg of the useful information you can get from Log Analytics.

Before I show you how to build this solution, lets briefly talk about Log Analytics and Logic Apps.

 

Log Analytics

Log Analytics falls under the umbrella of Azure Monitor and provides a repository of data that is queries using the Kusto Query Language. Typically, data is inserted into Log Analytics using an agent that can be added directly in Azure, using your System Center Operations Manager environment, or manually installing the agent. You can configure a Log Analytics Workspace to collect event logs, performance data, log files, etc. You can also implement Monitoring Solutions such as the “Update Compliance” solution to collect additional information. For our example we are wanting to report on failed logins which come from the Security event log so we must have implemented Azure Security Center for this information to be available.

 

Going in depth on Security Center or Azure Monitor is beyond the scope of this blog but if you’re interested then happy reading!

 

https://docs.microsoft.com/en-us/azure/azure-monitor/

https://docs.microsoft.com/en-us/azure/security-center/

 

Logic Apps

Logic Apps provides a graphical interface to run a workflow that integrates different components together. There is an amazing number of products that Logic Apps integrates with. For our example we will first connect to a Log Analytics Workspace, run a Kusto Query, and then email the alerts using Office 365. We could have just as easily sent the results to Google Mail or a slack channel. If you’re interested in the connectors available in Logic Apps take a look at the following link:

https://docs.microsoft.com/en-us/azure/connectors/apis-list

 

If you’re interested in detail documentation on the product here you go!

https://docs.microsoft.com/en-us/azure/logic-apps/

 

Example Solution

I’m going to walk through creating a report that is sent out once a day. For this walkthrough we will use Log Analytics to pull a list of failed logins by computer, format it into a HTML file, and attach that result to an email. To accomplish this, we need to:

  1. Create the Kusto Query that can pull this information
  2. Design a Logic Apps job to schedule the query and then email the results out

 

Creating the Kusto Query

In this scenario we already have an Azure Log Analytics Workspace and Security Center enabled and reporting to our workspace with the proper agents deployed. To start with open the Log Analytics Workspace and open “Logs” to start your Kusto query.

 

image001.png

 

 

First thing we need to do is pull from the correct data source. Whenever you are using Security Center (which included the Security Event Log) then we need to get information from SecurityEvent. So our query will start with

                SecurityEvent

 

Next we need to start filtering the data. You should always filter the data/time first so we will pull the last 24 hours using ago(1d). So our query will now look like this:

                SecurityEvent

                | where TimeGenerated >= ago(1d)

 

Next we will filter down to failed logins using Event Id 4625. Now our query looks like this:

                SecurityEvent

                | where TimeGenerated >= ago(1d)

                | where EventID == 4625

 

If you run this query you will get all the details on each failed login:

image003.png

 

But our final result we want to summarize the number of failed logins for each unique Account Name and Computer combination. To do this we can add a summarize statement as follows:

                  SecurityEvent

                | where TimeGenerated >= ago(1d)

                | where EventID == 4625

                | summarize FailedLogins=count() by Account,Computer

 

This gives us the information we want but it would be nice to order by the number of failed logins. We can add a sort by FailedLogins desc at the end of our query. The final query should look like this:

                SecurityEvent

                | where TimeGenerated >= ago(1d)

                | where EventID == 4625

                | summarize FailedLogins=count() by Account,Computer

                | sort by FailedLogins desc

 

The results should be a table with the results we would like to email out.

image005.png

 

Logic Apps

Now we need to move over to Logic Apps to build the logic that will email out the above results.

In Azure Logic Apps we’ll start by clicking “Add”

 

image007.png

 

Give it a descriptive name like ‘Daily-Failed-Login-Report’ and hit create to get started. Start designing your solution by going to “Logic app designer”

 

image009.png

 

Our solution is triggered off a schedule (once a day) so we can start with the template “Recurrence”

image011.png

 

Change the recurrence to once per day and click on “+ New step”

image013.png

 

Search for “Log Analytics” and choose “Run query and visualize results (preview)”

image015.png

 

Click on “Sign in” to log into Azure and select the Azure Log Analytics Workspace you want to query. Note that you might want to use a service principle to connect instead of a standard AAD account.

 

Once you sign in you’ll need to provide the following information:

                Subscription: Azure Subscription where the Log Analytics Workspace is located

                Resource Group

                Workspace

                Query

                Chart Type

 

image017.png

 

Once you have this filled out click on the “+ New Step” below your “Run query and visualize” activity. Search for “Office 365” and choose “Office 365 Outlook.” We can choose either “Send an email (V2) (preview)” or “Send an email from a shared mailbox (preview).” In this case because I don’t have a shared mailbox to use I’ll choose the first option.

image019.png

 

Sign into your Office 365 account to get started. Fill out the information that you want for:

                To

                Subject

                Body

image021.png

 

The last step is to add the HTML table from our Kusto query as an attachment. Drop down on the “Add new parameter” option and select “Attachments”

 

image023.png

 

This will supply you with two new fields to fill out. The attachment name and attachment content. We want to use the data from the previous step. First click in the box for the “Attachment Name.” This will bring up a window on the right hand side where you can select dynamic data. In this case we only had one previous step which was to run the query. So under “Run query and visualize results” choose “Attachment Name”

 

image025.png

 

Click in “Attachment Content” and this time choose “Attachment Name.”

That’s it! We need to first click on “Save” to commit our changes. After the save is complete we can click on the “Run” option to test our solution.

 

image027.png

 

You should get an email soon after with an attachment that looks something like the following:

 

image029.png

 

Summary

Azure Log Analytics is a powerful tool that allows you to gather a lot of data from all sorts of sources. The Kusto Query Language allows us to quickly access that data and determine trends and visualize the data. We walked through an easy way to utilize this power by scheduling a report using Azure Logic Apps.

 

Typically, any time you have a Kusto query that provides useful information you need to decide how to surface the data. The most common method to do this is:

  1. Create a view/dashboard using Log Analytics
  2. Create an alert that shows under the Unified Alerting experience in Azure Monitor
  3. Schedule the data to be delivered through Logic Apps. This could be through email like in this example or some other medium (SharePoint Document Library, Slack Channel, etc..)

 

I hope you enjoyed this walkthrough and see how you can utilize this in the future!

 

Brad Watts