%3CLINGO-SUB%20id%3D%22lingo-sub-189086%22%20slang%3D%22en-US%22%3EUsing%20the%20Office%20365%20Management%20Activity%20API%20and%20Power%20BI%20for%20security%20analysis%20(Part%201)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-189086%22%20slang%3D%22en-US%22%3E%3CP%3E%3CEM%3EPublishers%20note%3A%20I%20am%20posting%20this%20on%20behalf%20my%20colleague%20Jon%20Nordstrom%20who%20is%20part%20of%20the%20Office%20365%20customer%20experience%20team.%20Myself%20and%20few%20other%20engineers%20thought%20you%20would%20all%20benefit%20from%20his%20knowledge%20of%20the%20Office%20365%20management%20activity%20API%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EA%20common%20question%20we%20get%20from%20organizations%20that%20move%20to%20Office%20365%20is%2C%20how%20do%20I%20get%20visibility%20into%20transactions%20that%20effect%20the%20information%20stored%20in%20Office%20365.%20The%20%3CA%20href%3D%22https%3A%2F%2Fsupport.office.com%2Fen-us%2Farticle%2FSearch-the-audit-log-in-the-Office-365-Security-Compliance-Center-0d4d0f35-390b-4518-800e-0c7ec95e946c%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Esecurity%20and%20compliance%20center%3C%2FA%3E%20and%20the%20%3CA%20href%3D%22https%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Foffice-365%2Foffice-365-management-activity-api-reference%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EOffice%20365%20Management%20Activity%20API%3C%2FA%3E%20provide%20organizations%20with%20this%20visibility%20though%20detailed%20information%20with%20regards%20to%20user%2C%20admin%2C%20system%2C%20and%20policy%20actions%20and%20events%20from%20Office%20365%20and%20Azure%20Active%20Directory%20(Azure%20AD).%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EReviewing%20the%20wealth%20of%20information%20available%20via%20the%20API%20and%20the%20audit%20logs%2C%20can%20be%20challenging%20though.%20Triaging%20detection%20results%20manually%20and%20categorizing%20related%20activities%20into%20groups%20can%20be%20difficult.%20The%20amounts%20of%20data%20generated%20from%20likely%20malicious%20activity%20can%20overwhelm%20investigators%20with%20irrelevant%20results.%20We%20know%20from%20experience%20the%20importance%20of%20accurate%20tooling%2C%20Microsoft%20Online%20Services%20processes%20petabytes%20of%20event%20monitoring%20data.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20Microsoft%20Online%20Services%20engineering%20started%20on%20the%20journey%20to%20view%20detection%20results%20as%20graphs%20we%20found%20that%20it%20enabled%20us%20to%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3Eevaluate%20intrusion%20detection%20results%20in%20context%20with%20related%20activity%3C%2FLI%3E%0A%3CLI%3Eincorporate%20lower-fidelity%20indicators%20without%20being%20overwhelmed%20with%20benign%20results%3C%2FLI%3E%0A%3CLI%3Edetermine%20with%20greater%20fidelity%20when%20datacenter%20activity%20is%20likely%20to%20represent%20an%20intrusion%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20this%20first%20post%20of%20our%20two-part%20series%20we%20will%20to%20help%20you%20understand%20how%20you%20can%20get%20the%20data%20necessary%20to%20perform%20a%20security%20analysis%20of%20it.%20The%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FSecurity-Privacy-and-Compliance%2FUsing-the-Office-365-Management-Activity-API-and-Power-BI-for%2Fba-p%2F190551%22%20target%3D%22_blank%22%3Esecond%20post%3C%2FA%3E%20will%20focus%20on%20examples%20scenarios%20and%20using%20Power%20BI%20to%20visualize%20the%20data.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWe%20are%20going%20to%20use%20%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fservices%2Fcosmos-db%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Cosmos%20DB%3C%2FA%3E%2C%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-functions%2Ffunctions-overview%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Function%20Apps%3C%2FA%3E%20and%20%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fservices%2Fstorage%2Fqueues%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ecloud%20message%20queue%3C%2FA%3E%3CU%3Es%3C%2FU%3E%20to%20retrieve%20and%20store%20information.%20The%20data%20stores%20can%20be%20removed%20or%20purged%2C%20and%20the%20solution%20can%20be%20disabled%20or%20removed.%20Azure%20Cosmos%20DB%20also%20allows%20for%20the%20concept%20of%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fcosmos-db%2Ftime-to-live%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3ETTL%3C%2FA%3E%20to%20expire%20content%20if%20you%20continue%20to%20synchronize%20the%20information.%20The%20sample%20graphs%20generated%20in%20this%20post%20were%20created%20with%20the%20free%20version%20of%20the%20%3CA%20href%3D%22https%3A%2F%2Fappsource.microsoft.com%2Fen-us%2Fproduct%2Fpower-bi-visuals%2FWA104381419%3Ftab%3DOverview%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EZoomCharts%20add-in%20for%20Power%20BI%20Desktop%3C%2FA%3E.%20Depending%20on%20your%20need%20there%20are%20several%20other%20graph%20add-ins%20available%20such%20as%20%3CA%20href%3D%22https%3A%2F%2Fappsource.microsoft.com%2Fen-us%2Fproduct%2Fpower-bi-visuals%2FWA104380795%3Fsrc%3Doffice%26amp%3Btab%3DOverview%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3ENetwork%20Navigator%20Chart%3C%2FA%3E%20and%20%3CA%20href%3D%22https%3A%2F%2Fappsource.microsoft.com%2Fen-us%2Fproduct%2Fpower-bi-visuals%2FWA104380764%3Fsrc%3Doffice%26amp%3Btab%3DOverview%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EForce-Directed%20Graph%3C%2FA%3E.%20If%20you%20already%20have%20a%20method%20for%20obtaining%20data%20from%20the%20Activity%20API%20such%20as%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Flog-analytics%2Flog-analytics-add-solutions%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Log%20Analytics%3C%2FA%3E%20%2C%20then%20continue%20to%20use%20that%20and%20access%20the%20information%20from%20Power%20BI%20which%20we%20briefly%20discuss%20in%20this%20post%20and%20go%20into%20more%20detail%20in%20next%20post.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1623608540%22%20id%3D%22toc-hId--1383064624%22%3E1.%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Register%20an%20App%20with%20Azure%20Active%20Directory%3C%2FH2%3E%0A%3CP%3EUse%20%3CA%20href%3D%22https%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Foffice-365%2Fget-started-with-office-365-management-apis%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ethis%3C%2FA%3E%20as%20a%20guide%20to%20create%20and%20register%20an%20application%20for%20making%20calls%20to%20the%20Office%20365%20Activity%20API.%20There%20are%20more%20detailed%20information%20about%20app%20registrations%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Factive-directory%2Fdevelop%2Factive-directory-integrating-applications%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E.%20For%20this%20environment%2C%20the%20%E2%80%9CConfigure%20an%20X.509%20certificate%20to%20enable%20service-to-service%20calls%E2%80%9D%20is%20not%20necessary%3B%20it%20is%20enough%20to%20have%20an%20application%20with%20the%20appropriate%20permissions%20set.%20Don%E2%80%99t%20forget%20to%20complete%20the%20Administrator%20consent.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--928548421%22%20id%3D%22toc-hId-1104448209%22%3E2.%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Setting%20up%20the%20infrastructure%20to%20push%20the%20Office%20365%20activities%3C%2FH2%3E%0A%3CP%3EThe%20first%20step%20is%20to%20push%20the%20information%20you%20need%20to%20a%20store.%20We%E2%80%99ll%20use%20this%20sample%20from%20GitHub%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FOfficeDev%2FO365-ActivityFeed-AzureFunction%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2FOfficeDev%2FO365-ActivityFeed-AzureFunction%3C%2FA%3E%20that%20allow%20you%20to%20push%20the%20past%20seven%20days%20of%20Office%20365%20Activity%20data%20to%20an%20instance%20of%20%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fservices%2Fcosmos-db%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Cosmos%20DB%3C%2FA%3E.%20You%20can%20limit%20the%20number%20of%20days%20and%20the%20workloads%20as%20needed.%20The%20code%20is%20created%20to%20run%20in%20two%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-functions%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Functions%3C%2FA%3E%20(PowerShell%20is%20currently%20in%20preview).%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EAzure%20Function%201%20places%20activity%20messages%20in%20a%20%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fservices%2Fstorage%2Fqueues%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ecloud%20message%20queue%3C%2FA%3E.%3C%2FLI%3E%0A%3CLI%3EAzure%20Function%202%20picks%20up%20messages%20from%20that%20queue%20and%20transmits%20them%20to%20Azure%20Cosmos%20DB.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId-617748409%22%20id%3D%22toc-hId-1795009683%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B1.%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Create%20Function%201.%20(QueueEvents.ps1)%3C%2FH3%3E%0A%3CP%3ERemember%20to%20register%20a%20new%20Application%20in%20Azure%20Active%20Directory%20with%20adequate%20permissions%20before%20you%20take%20these%20steps.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20don%E2%80%99t%20already%20have%20a%20Function%20App%20start%20to%20create%20one.%20By%20default%2C%20runtime%20is%20limited%20to%205%20minutes%20for%20the%20functions%20running%20under%20the%20consumption%20plans%2C%20however%2C%20you%20can%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-functions%2Ffunctions-scale%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Eincrease%3C%2FA%3E%20the%20runtime%20up%20to%2010%20minutes.%20An%20alternative%20is%20to%20use%20the%20App%20Consumption%20plan%20if%20you%20expect%20longer%20execution%20times.%20The%20consumption%20plans%20typically%20cover%20the%20need%20for%20retrieving%20the%20event%20data.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20163px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F33358i34EC88A1464843D5%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2201.png%22%20title%3D%2201.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3CP%3ECreate%20a%20New%20Function%20in%20the%20Function%20App%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20422px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F33359iD0DFD795071492C0%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2202.png%22%20title%3D%2202.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3CP%3EEnable%20experimental%20Language%20support%2C%20select%20Timer%20trigger%20and%20PowerShell.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20624px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F33360i63B73A75DE998C6F%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2203.png%22%20title%3D%2203.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3CP%3EName%20the%20new%20function%2C%20and%20select%20the%20schedule%20for%20the%20trigger%2C%20which%20determines%20how%20often%20the%20function%20will%20pull%20data.%20A%20workload.log%20file%20is%20used%20to%20keep%20track%20of%20time%20to%20prevent%20duplicate%20requests.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20244px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F33361iAB54471D977444E0%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%2204.png%22%20title%3D%2204.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%223%22%3ENext%2C%20paste%20the%20code%20for%20function%201.%2C%20%3C%2FFONT%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FOfficeDev%2FO365-ActivityFeed-AzureFunction%2Ftree%2Fmaster%2Finvestigation%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CU%3E%3CFONT%20color%3D%22%230563c1%22%20size%3D%223%22%3EQueueEvents.ps1%3C%2FFONT%3E%3C%2FU%3E%3C%2FA%3E%3CFONT%20size%3D%223%22%3E%20to%20the%20function.%3C%2FFONT%3E%3C%2FP%3E%0A%3CDIR%3E%3CDIR%3E%3C%2FDIR%3E%3C%2FDIR%3E%0A%3CP%3EAdjust%20the%20variables%20for%20sign%20in%20based%20on%20the%20AAD%20application%20registered.%20The%20Tenant%20GUID%20can%20be%20found%20under%20the%20Endpoints%20in%20the%20app%20registration.%20It%20is%20listed%20as%20part%20of%20the%20endpoints.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20624px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F33427iC37A0724E91AA6E3%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2205.png%22%20title%3D%2205.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWe%20will%20come%20back%20to%20adjust%20the%20storage%20variables%20shortly%20as%20part%20of%20the%20integration%20of%20the%20storage%20queues.%20Optionally%20modify%20the%20included%20workloads%20or%20message%20size.%20Note%20that%20reducing%20message%20size%20will%20increase%20the%20number%20of%20times%20Azure%20Function%202%20is%20run.%20Making%20message%20size%20too%20large%20(for%20example%2C%20%26gt%3B%20100)%20may%20cause%20you%20to%20exceed%20the%20limits%20of%20the%20queue%20and%20reduce%20performance.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20624px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F33363i23EF8255045A7F24%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2206.png%22%20title%3D%2206.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%223%22%3ENext%2C%20select%20integrate%20and%20add%20an%20Azure%20Queue%20Storage%20output.%20The%20queue%20name%20is%20specified%20using%20the%20%3C%2FFONT%3E%3CFONT%20face%3D%22Courier%20New%22%20size%3D%223%22%3E%24storageQueue%3C%2FFONT%3E%3CFONT%20size%3D%223%22%3E%20variable%20use%20%3C%2FFONT%3E%3CFONT%20face%3D%22Courier%20New%22%20size%3D%223%22%3E%E2%80%98outQueue%E2%80%99%3C%2FFONT%3E%3CFONT%20size%3D%223%22%3Ewith%20single%20quotes%3C%2FFONT%3E%20%3CFONT%20size%3D%223%22%3Eunless%20you%20changed%20the%20queue%20name%20in%20the%20output%20settings.%20Click%2C%20Show%20Value%20on%20the%20%22Storage%20account%20connection%22%20and%20copy%20the%20Account%20key%20value%20to%20%3C%2FFONT%3E%3CFONT%20face%3D%22Courier%20New%22%20size%3D%223%22%3E%24StorageAccountKey%3C%2FFONT%3E%3CFONT%20size%3D%223%22%3E%20and%20the%20AccountName%20to%20%3C%2FFONT%3E%3CFONT%20face%3D%22Courier%20New%22%20size%3D%223%22%3E%24StorageAccountName.%3C%2FFONT%3E%3CFONT%20size%3D%223%22%3E%20These%20steps%20are%20required%20to%20use%20cloud%20queue%20functionality.%20A%20regular%20storage%20queue%20call%20does%20not%20allow%20for%20multiple%20objects.%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20624px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F33364i53C490D53BB5BD83%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2207.png%22%20title%3D%2207.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EDo%20verify%20that%20the%20queue%20was%20created%2C%20there%20have%20been%20some%20instances%20in%20the%20testing%20where%20they%20weren%E2%80%99t.%20In%20that%20case%20create%20a%20queue%20manually%20in%20the%20associated%20storage%20account.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20477px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F33365iFB3DC2382D5DE73A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2208.png%22%20title%3D%2208.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--1934408552%22%20id%3D%22toc-hId--12444780%22%3E%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%202.%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Create%20Function%202.%20(StoreEvents.ps1)%3C%2FH3%3E%0A%3CP%3EFollow%20these%20steps%20to%20create%20the%20second%20function%2C%20which%20is%20a%20Queue%20trigger.%20Create%20a%20new%20Function%20in%20the%20previously%20created%20Function%20App.%26nbsp%3B%20Provide%20a%20Queue%20name%20and%20the%20storage%20account%20defined%20in%20Function%201.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20236px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F33366iCEB776377C4C2464%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%2209.png%22%20title%3D%2209.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAdd%20the%20code%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FOfficeDev%2FO365-ActivityFeed-AzureFunction%2Ftree%2Fmaster%2Finvestigation%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EStoreEvents.ps1%3C%2FA%3E%20and%20the%20information%20for%20the%20auth%20variables.%20The%20%24triggerInput%20variable%20is%20the%20message%20parameter%20name.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20624px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F33367i8D5E42C7A91D9EA2%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2210.png%22%20title%3D%2210.png%22%20%2F%3E%3C%2FSPAN%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESelect%20Integrate%20and%20add%20a%20Cosmos%20DB.%20The%20%24outputdocument%20variable%20is%20based%20on%20the%20Document%20parameter%20name.%20If%20you%20change%20the%20name%2C%20you%20must%20also%20change%20the%20name%20of%20the%20variable.%20Click%20Show%20Value%20for%20%E2%80%9CAzure%20Cosmos%20DB%20account%20connection%E2%80%9D%20and%20store%20the%20account%20key%20for%20making%20requests%20from%20Power%20BI%20(an%20alternative%20is%20to%20navigate%20to%20the%20Cosmos%20DB%20and%20use%20a%20read-only%20key).%3C%2FP%3E%0A%3CP%3EIf%20you%20don%E2%80%99t%20already%20have%20an%20Azure%20Cosmos%20DB%20in%20place%20create%20a%20new%20database%20before%20creating%20the%20output.%20%3CEM%3EIf%20you%20don%E2%80%99t%20have%20a%20Cosmos%20DB%20and%20collection%2C%20ensure%20to%20set%20the%20checkbox%20to%20create%20the%20Azure%20Cosmos%20DB%20and%20collection.%3C%2FEM%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20624px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F33369i897EAF36E5326FD1%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2211.png%22%20title%3D%2211.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CEM%3E%26nbsp%3B%3C%2FEM%3E%3C%2FP%3E%0A%3CH3%20id%3D%22toc-hId--191598217%22%20id%3D%22toc-hId--1819899243%22%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%203.%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Start%20the%20functions.%3C%2FH3%3E%0A%3CP%3E%3CFONT%20size%3D%223%22%3EIf%20you%20haven%E2%80%99t%20enabled%20the%20Office%20365%20Activity%20API%20subscriptions%20that%20is%20the%20first%20step%20to%20take.%20There%20is%20a%20sample%20script%20for%20how%20to%20enable%20the%20subscriptions%20at%20the%20%3C%2FFONT%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FOfficeDev%2FO365-ActivityFeed-AzureFunction%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CU%3E%3CFONT%20color%3D%22%230563c1%22%20size%3D%223%22%3EGitHub%20page%3C%2FFONT%3E%3C%2FU%3E%3C%2FA%3E%3CFONT%20size%3D%223%22%3E%20it%20can%20be%20run%20from%20on-premises%20(Enablesubscription.ps1).%20Do%20enable%20%3C%2FFONT%3E%3CA%20href%3D%22https%3A%2F%2Fsupport.office.com%2Fen-us%2Farticle%2Fturn-office-365-audit-log-search-on-or-off-e893b19a-660c-41f2-9074-d3631c95a014%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CU%3E%3CFONT%20color%3D%22%230563c1%22%20size%3D%223%22%3EOffice%20365%20audit%20log%20search%3C%2FFONT%3E%3C%2FU%3E%3C%2FA%3E%3CFONT%20size%3D%223%22%3E%20as%20well.%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20configuring%20a%20start%20date%20for%20retrieving%20data%2C%20note%20that%20the%20maximum%20time%20span%20is%20the%20past%207%20days%20based%20on%20Activity%20API%20restrictions.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%223%22%3EIf%20you%20change%20variable%20%3C%2FFONT%3E%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%24StoredTime%3C%2FFONT%3E%20%3CFONT%20color%3D%22%23a9a9a9%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%3D%3C%2FFONT%3E%20%3CFONT%20color%3D%22%230000ff%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3EGet-content%3C%2FFONT%3E%20%3CFONT%20color%3D%22%23ff4500%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%24Tracker%20%3C%2FFONT%3E%3CFONT%20size%3D%223%22%3Eto%20a%20date%20in%20the%20format%20of%20%22yyyy-MM-ddTHH%3Amm%3Ass.fffZ%22%20the%20workloads%20will%20use%20it%20as%20the%20starting%20point%20(e.g.%2C%3C%2FFONT%3E%3CFONT%20color%3D%22%238b0000%22%20face%3D%22Lucida%20Console%22%20size%3D%221%22%3E%20%24StoredTime%20%3D%20%222018-04-12T01%3A34%3A18.702Z%22%3C%2FFONT%3E%3CFONT%20size%3D%223%22%3E).%3C%2FFONT%3E%20%3CI%3E%3CFONT%20size%3D%223%22%3EEither%20disable%20the%20function%20after%20it%20has%20completed%20a%20first%20run%20or%20replace%20it%20with%20Get-content%20%24Tracker%20as%20the%20next%20scheduled%20run%20will%20process%20the%20same%20data%20if%20not%20adjusted.%20%3C%2FFONT%3E%3C%2FI%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CFONT%20size%3D%223%22%3EAlternatively%2C%20you%20can%20use%20%3C%2FFONT%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Ffeatures%2Fstorage-explorer%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CU%3E%3CFONT%20color%3D%22%230563c1%22%20size%3D%223%22%3EAzure%20Storage%20Explorer%3C%2FFONT%3E%3C%2FU%3E%3C%2FA%3E%3CFONT%20size%3D%223%22%3E%20and%20add%20these%20files%20with%20your%20desired%20start%20time%20to%20the%20root%20of%20the%20Azure%20functions%20blob%20store%3A%3C%2FFONT%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EAudit.AzureActiveDirectory.log%3C%2FLI%3E%0A%3CLI%3EAudit.SharePoint.log%3C%2FLI%3E%0A%3CLI%3EAudit.Exchange.log%3C%2FLI%3E%0A%3CLI%3EAudit.General.log%3C%2FLI%3E%0A%3CLI%3EDLP.All.log%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EThe%20only%20thing%20you%20need%20in%20the%20file%20is%20the%20date%20example%20%222018-03-27T11%3A34%3A18.702Z%22%20%3CSTRONG%3Ewithout%20the%20quotation%20marks%3C%2FSTRONG%3E.%20The%20log%20files%20allow%20for%20continuous%20synch%20excluding%20content%20previously%20synchronized.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20624px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F33426i12E5A11A2B988EEE%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2212.png%22%20title%3D%2212.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWhen%20the%20functions%20are%20started%2C%20invocation%20logs%20will%20indicate%20if%20there%20are%20any%20issues.%20Use%20Azure%20Storage%20Explorer%20to%20view%20the%20storage%20queues.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20the%20function%20for%20some%20reason%20breaks%20the%20%3CEM%3Eworkload%3C%2FEM%3E.log%20files%20will%20not%20be%20updated%2C%20and%20the%20function%20will%20start%20from%20the%20date%20last%20stamped%20in%20the%20%3CEM%3Eworkload%3C%2FEM%3E.log%20file.%20There%20may%20be%20some%20overlap%2C%20but%20the%20analysis%20tools%20will%20identify%20any%20duplicates.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EEnsure%20that%20the%20data%20is%20reaching%20your%20Cosmos%20DB%20instance%20by%20navigating%20to%20the%20Database%2C%20as%20shown%20below.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20624px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F33371iFBCC8CC73269F176%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2213.png%22%20title%3D%2213.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1747725623%22%20id%3D%22toc-hId--1830402347%22%3E3.%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20Open%20the%20data%20in%20Power%20BI%3C%2FH2%3E%0A%3CP%3E%3CLI-WRAPPER%3E%3C%2FLI-WRAPPER%3E%3C%2FP%3E%0A%3CP%3EDownload%20the%20%3CA%20href%3D%22https%3A%2F%2Fpowerbi.microsoft.com%2Fen-us%2Fget-started%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EPower%20BI%20Desktop%20client%3C%2FA%3E%20and%20the%20%3CA%20href%3D%22https%3A%2F%2Fappsource.microsoft.com%2Fen-us%2Fproduct%2Fpower-bi-visuals%2FWA104381419%3Ftab%3DOverview%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EZoomCharts%3C%2FA%3E%20referenced%20previously.%20Select%20to%20connect%20to%20Azure%20Cosmos%20DB%20in%20the%20Power%20BI%20desktop%20client.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%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%2F33411i8E5E8BE3368D1B50%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2215.png%22%20title%3D%2215.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESpecify%20your%20connection%20string%2C%20etc.%2C%20and%20optionally%20specify%20a%20query%20to%20limit%20the%20scope%20to%20the%20asset%20you%20want%20to%20investigate.%20Do%20remember%20that%20everything%20is%20case%20sensitive.%20In%20this%20case%20I%20have%20scoped%20it%20down%20to%20a%20specific%20site.%20Please%20see%20the%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FOfficeDev%2FO365-ActivityFeed-AzureFunction%2Ftree%2Fmaster%2Finvestigation%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EGitHub%20page%3C%2FA%3E%20for%20more%20query%20samples.%20The%20subsequent%20step%20will%20require%20the%20Cosmos%20DB%20storage%20key%20that%20you%20stored%20as%20part%20of%20setting%20up%20the%20Cosmos%20DB.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%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%2F33412i049AAB8CE43105AB%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2216.png%22%20title%3D%2216.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EExpand%20the%20columns%20by%20selecting%20the%20expand%20arrows.%20When%20done%20close%20and%20apply.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F33413i506C015EE4AE4909%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20alt%3D%2217.png%22%20title%3D%2217.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EImport%20the%20Zoomchart%20visual%20if%20you%20haven%E2%80%99t%20completed%20that%20step%20previously.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%26nbsp%3B%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%2F33414iCA7C3684F60B1183%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2218.png%22%20title%3D%2218.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELoad%20the%20Nodes%20you%20want%20to%20review%20and%20the%20Measure.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%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%2F33415i074F2BBEF93C69FD%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2219.png%22%20title%3D%2219.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EChange%20the%20Measure%20to%20count%20to%20make%20the%20node%20sizes%20reflect%20the%20actual%20number%20of%20occurrences%20as%20an%20example%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20574px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F33416iD5E5C08D433D6D60%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2220.png%22%20title%3D%2220.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20many%20cases%20you%20can%20export%20csv%20files%20or%20directly%20make%20relationships%20to%20existing%20data%20and%20join%20it%20with%20the%20activity%20data.%20This%20is%20an%20example%20where%20we%20imported%20a%20few%20admin%20accounts%20from%20adminlist.csv.%20It%20could%20just%20as%20well%20be%20a%20number%20of%20files%20or%20ip%20addresses%20for%20which%20you%20need%20more%20information.%20We%20loaded%20the%20csv%20file.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%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%2F33417iA3268213115B86A8%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2221.png%22%20title%3D%2221.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20the%20next%20step%20we%20went%20to%20Relationships%20and%20joined%20the%20Adminlist%20with%20the%20UserID%20field%20to%20allow%20us%20to%20eliminate%20all%20accounts%20but%20those%20we%20are%20investigating.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%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%2F33418i50F15B9342F34108%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2222.png%22%20title%3D%2222.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20the%20visual%20level%20filter%2C%20we%20removed%20any%20account%20but%20those%20we%20are%20investigating%3C%2FP%3E%0A%3CP%20style%3D%22margin%3A%200in%200in%208pt%3B%22%3E%3CFONT%20color%3D%22%23000000%22%20face%3D%22Calibri%22%3E%26nbsp%3B%3C%2FFONT%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20310px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F33419i8456996825407B4E%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%2223.png%22%20title%3D%2223.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--804431338%22%20id%3D%22toc-hId-657110486%22%3ESummary%3C%2FH2%3E%0A%3CP%3EWe%20have%20provided%20you%20with%20a%20starting%20point%20for%20how%20to%20analyze%20Office%20365%20Data%20using%20Power%20BI.%20The%20data%20can%20be%20pivoted%20and%20analyzed%20in%20many%20ways.%20Templates%20and%20continuously%20pulling%20the%20Activity%20Data%20can%20be%20used%20to%20quickly%20load%20data%20and%20draw%20conclusions%20from%20the%20wealth%20of%20information.%20Other%20event%20sources%20such%20as%20on%20premises%20Intrusion%20Detection%20Systems%2C%20Information%20classification%20systems%20or%20Azure%20Information%20Protection%20may%20be%20used%20to%20join%20with%20the%20activity%20data%20to%20improve%20visibility.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOur%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2FSecurity-Privacy-and-Compliance%2FUsing-the-Office-365-Management-Activity-API-and-Power-BI-for%2Fba-p%2F190551%22%20target%3D%22_blank%22%3Enext%20post%3C%2FA%3E%20will%20provide%20more%20examples%20of%20analyzing%20information%20using%20Graphs.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20have%20any%20feedback%20please%20provide%20it%20at%20the%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FOfficeDev%2FO365-ActivityFeed-AzureFunction%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EGitHub%20project%3C%2FA%3E%20page%20or%20by%20emailing%20it%20to%20cxprad%40microsoft.com.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EWe%20look%20forward%20to%20hearing%20from%20you!%3C%2FP%3E%0A%3CP%3E%E2%80%94Jon%20Nordstrom%2C%20senior%20program%20manager%2C%20Office%20365%20customer%20experience%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-189086%22%20slang%3D%22en-US%22%3E%3CP%3EA%20common%20question%20we%20get%20from%20organizations%20that%20move%20to%20Office%20365%20is%2C%20how%20do%20I%20get%20visibility%20into%20transactions%20that%20effect%20the%20information%20stored%20in%20Office%20365.%20The%20security%20and%20compliance%20center%20and%20the%20Office%20365%20Management%20Activity%20API%20provide%20organizations%20with%20this%20visibility%20though%20detailed%20information%20with%20regards%20to%20user%2C%20admin%2C%20system%2C%20and%20policy%20actions%20and%20events%20from%20Office%20365%20and%20Azure%20Active%20Directory%20(Azure%20AD).%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-189086%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-329214%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20the%20Office%20365%20Management%20Activity%20API%20and%20Power%20BI%20for%20security%20analysis%20(Part%201)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-329214%22%20slang%3D%22en-US%22%3E%3CP%3EGreat%20article%20guys%2C%20thanks%20for%20sharing!%20It%20worked%20perfectly%20for%20me.%20Now%20I'm%20using%20it%20with%20Dynamics%20365%20Customer%20Engagement%20and%20the%20Power%20Platform.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-316979%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20the%20Office%20365%20Management%20Activity%20API%20and%20Power%20BI%20for%20security%20analysis%20(Part%201)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-316979%22%20slang%3D%22en-US%22%3E%3CP%3EIt%20seems%20from%20the%20opening%20statements%20that%20there%20is%20clear%20and%20strong%20impetus%20for%20this%20being%20a%20product%20feature%2C%20not%20an%20example.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20movement%20toward%20always%20having%20this%20stuff%20available%20somewhere%20like%20the%20above%2C%20or%20Kusto%2C%20with%20a%20powerful%2C%20query-able%20endpoint%20for%20Power%20BI%3F%20Then%20the%20portal%20could%20have%20a%20the%20simplified%20query%20tool%20on%20top%20of%20that%20power.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%2C%3C%2FP%3E%3CP%3EEric%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-287362%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20the%20Office%20365%20Management%20Activity%20API%20and%20Power%20BI%20for%20security%20analysis%20(Part%201)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-287362%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F29813%22%20target%3D%22_blank%22%3E%40Jon%3C%2FA%3E%20Nordstrom%20thanks%20for%20the%20clarity.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-286941%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20the%20Office%20365%20Management%20Activity%20API%20and%20Power%20BI%20for%20security%20analysis%20(Part%201)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-286941%22%20slang%3D%22en-US%22%3E%3CP%3EThank%20you%20Steve%20for%20reaching%20out%2C%20I%20originally%20set%20this%20up%20using%20webhooks%20but%20found%20that%20the%20option%20I%20have%20with%20a%20timer%20function%20and%20cloud%20message%20queues%20are%20more%20performant.%20I%20still%20kept%20the%20WebHook%20code%20in%20there%2C%20since%20it%20may%20be%20useful%20for%20some%20scenarios.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20EnableSubscriptions.ps1%20in%20the%20investigations%20folder%20is%20starting%20the%20subscriptions%20needed%20for%20the%20scheduled%20function.%20Please%20use%20the%20blog%20post%20steps%20to%20set%20the%20timer%20function%20up%2C%20I%20never%20created%20a%20dedicated%20.md%20for%20that%20config.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20one%20in%20the%20%26nbsp%3Broot%20works%20with%20the%20description%20I%20have%20in%20readme.md%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20stick%20to%20the%20description%20on%20the%20repo%20and%20use%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FOfficeDev%2FO365-ActivityFeed-AzureFunction%2Fblob%2Fmaster%2FActivityFunctionApp.ps1%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2FOfficeDev%2FO365-ActivityFeed-AzureFunction%2Fblob%2Fmaster%2FActivityFunctionApp.ps1%3C%2FA%3E%20you%20can%20use%20the%20webhook%20function.%20Which%20is%20enabled%20by%20EnableSubscriptions.ps1%20in%20the%20root.%20%3CSTRONG%3E%E2%80%9C%3C%2FSTRONG%3E%3CSTRONG%3ESteps%20to%20Create%20the%20Azure%20Function%E2%80%9D%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ESorry%20for%20the%20confusion%2C%3C%2FP%3E%0A%3CP%3EJon%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-286549%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20the%20Office%20365%20Management%20Activity%20API%20and%20Power%20BI%20for%20security%20analysis%20(Part%201)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-286549%22%20slang%3D%22en-US%22%3E%3CP%3EI%20seem%20to%20get%20lost%20on%20the%20start%20function%20section.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20state%20run%20EnableSubscriptions.ps1%2C%20in%20the%20repo%2C%20there%20are%20two.%26nbsp%3B%20One%20in%20the%20investigations%20folder%20(where%20your%20other%20scripts%20have%20come%20from)%20and%20one%20at%20the%20root%2C%20where%20your%20link%20goes.%26nbsp%3B%20The%20one%20at%20the%20root%20needs%20a%20webhookurl%2C%20which%20web%20hook%3F%26nbsp%3B%20Neither%20work%20as%20they%20don't%20have%20a%20http%20response%20any%20more.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-277591%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20the%20Office%20365%20Management%20Activity%20API%20and%20Power%20BI%20for%20security%20analysis%20(Part%201)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-277591%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F165398%22%20target%3D%22_blank%22%3E%40Jon%20Nordstr%C3%B6m%3C%2FA%3E...%20that%20worked%20a%20treat.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20case%20anybody%20else%20cannot%20find%20the%20settings%20mentioned%20above%20here%20is%20what%20I%20did%20to%20set%20my%20function%20to%201.x.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20clicked%20on%20Function%20Apps%20on%20the%20left%20hand%20menu.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThen%20I%20clicked%20on%20the%20function%20app%20in%20question.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20then%20clicked%20on%20Platform%20features%20(tab).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EUnder%20General%20Settings%20I%20clicked%20%22Application%20Settings%22.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20then%20scrolled%20down%20to%20Application%20Settings%20and%20chose%20to%20Show%20Values....%20I%20changed%20to%20value%20for%26nbsp%3BFUNCTIONS_EXTENSION_VERSION%20from%20~2%20to%20~1.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-277498%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20the%20Office%20365%20Management%20Activity%20API%20and%20Power%20BI%20for%20security%20analysis%20(Part%201)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-277498%22%20slang%3D%22en-US%22%3E%3CP%3EIt%20may%20be%20that%20you%20are%20using%20the%20V2%20engine%20where%20the%20experimental%20languages%20aren't%20available.%20Try%20to%20configure%20your%20Azure%20function%20to%20use%201.x%20it%20should%20allow%20you%20to%20specify%20the%20experimental%20language.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-277101%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20the%20Office%20365%20Management%20Activity%20API%20and%20Power%20BI%20for%20security%20analysis%20(Part%201)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-277101%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F165398%22%20target%3D%22_blank%22%3E%40Jon%20Nordstr%C3%B6m%3C%2FA%3E%26nbsp%3BThanks%20for%20the%20note.%20Unfortunately%20that%20toggle%20to%20enable%20experimental%20language%20support%20does%20not%20show%20for%20me%20for%20some%20reason.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-277067%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20the%20Office%20365%20Management%20Activity%20API%20and%20Power%20BI%20for%20security%20analysis%20(Part%201)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-277067%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Tony%2C%20PowerShell%20is%20still%20in%20experimental%20language%20support.%26nbsp%3B%20When%20you%20are%20creating%20the%20Function%20ensure%20to%20enable%20experimental%20language%20support%20and%20you%20will%20find%20PowerShell%20as%20an%20option.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20hope%20that%20it%20works%20out%20well.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-276961%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20the%20Office%20365%20Management%20Activity%20API%20and%20Power%20BI%20for%20security%20analysis%20(Part%201)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-276961%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20not%20seeing%20anyway%20in%20Azure%20to%20use%20Powershell%20for%20these%20scripts.%20My%20only%20options%20are%20Java%2C%20Javascript%20and%20C%23.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThrough%20the%20Azure%20interface%20at%20least.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThoughts%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-216296%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20the%20Office%20365%20Management%20Activity%20API%20and%20Power%20BI%20for%20security%20analysis%20(Part%201)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-216296%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Dean%2C%20thank%20you%20for%20reaching%20out.%20The%20%22%3CSPAN%3ERead%20activity%20data%20for%20your%20organization%3C%2FSPAN%3E%22%20will%20grant%20you%20the%20permissions%20needed%20to%20read%20and%20publish%20the%20activity%20data.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-215399%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20the%20Office%20365%20Management%20Activity%20API%20and%20Power%20BI%20for%20security%20analysis%20(Part%201)%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-215399%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F51275%22%20target%3D%22_blank%22%3E%40Anthony%20Smith%20(A.J.)%3C%2FA%3EWhen%20i%20register%20the%20app%20in%20Azure%20AD%2C%20there%20are%20duplicate%20permissions%20shown.%20Can%20you%20tell%20me%20why%20or%20which%20ones%20to%20use%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CDIV%20class%3D%22azc-grid-tableContent%22%3E%3CTABLE%3E%3CTBODY%3E%3CTR%3E%3CTD%3E%3CDIV%20class%3D%22azc-grid-cellContent%22%3E%3CDIV%20class%3D%22azc-vivaControl%22%3E%3CDIV%3ERead%20threat%20intelligence%20data%20for%20your%20organization%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E%3CDIV%20class%3D%22azc-grid-cellContent%22%3E%3CDIV%20class%3D%22azc-vivaControl%22%3E%3CDIV%3ERead%20activity%20reports%20for%20your%20organization%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E%3CDIV%20class%3D%22azc-grid-cellContent%22%3E%3CDIV%20class%3D%22azc-vivaControl%22%3E%3CDIV%3ERead%20threat%20intelligence%20data%20for%20your%20organization%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FTD%3E%3C%2FTR%3E%3CTR%3E%3CTD%3E%3CDIV%20class%3D%22azc-grid-cellContent%22%3E%3CDIV%20class%3D%22azc-vivaControl%22%3E%3CDIV%3ERead%20activity%20reports%20for%20your%20organization%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FTD%3E%3C%2FTR%3E%3C%2FTBODY%3E%3C%2FTABLE%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E

Publishers note: I am posting this on behalf my colleague Jon Nordstrom who is part of the Office 365 customer experience team. Myself and few other engineers thought you would all benefit from his knowledge of the Office 365 management activity API

 

A common question we get from organizations that move to Office 365 is, how do I get visibility into transactions that effect the information stored in Office 365. The security and compliance center and the Office 365 Management Activity API provide organizations with this visibility though detailed information with regards to user, admin, system, and policy actions and events from Office 365 and Azure Active Directory (Azure AD).

 

Reviewing the wealth of information available via the API and the audit logs, can be challenging though. Triaging detection results manually and categorizing related activities into groups can be difficult. The amounts of data generated from likely malicious activity can overwhelm investigators with irrelevant results. We know from experience the importance of accurate tooling, Microsoft Online Services processes petabytes of event monitoring data.

 

When Microsoft Online Services engineering started on the journey to view detection results as graphs we found that it enabled us to:

  • evaluate intrusion detection results in context with related activity
  • incorporate lower-fidelity indicators without being overwhelmed with benign results
  • determine with greater fidelity when datacenter activity is likely to represent an intrusion

 

In this first post of our two-part series we will to help you understand how you can get the data necessary to perform a security analysis of it. The second post will focus on examples scenarios and using Power BI to visualize the data.

 

We are going to use Azure Cosmos DB, Azure Function Apps and cloud message queues to retrieve and store information. The data stores can be removed or purged, and the solution can be disabled or removed. Azure Cosmos DB also allows for the concept of TTL to expire content if you continue to synchronize the information. The sample graphs generated in this post were created with the free version of the ZoomCharts add-in for Power BI Desktop. Depending on your need there are several other graph add-ins available such as Network Navigator Chart and Force-Directed Graph. If you already have a method for obtaining data from the Activity API such as Azure Log Analytics , then continue to use that and access the information from Power BI which we briefly discuss in this post and go into more detail in next post.

 

1.      Register an App with Azure Active Directory

Use this as a guide to create and register an application for making calls to the Office 365 Activity API. There are more detailed information about app registrations here. For this environment, the “Configure an X.509 certificate to enable service-to-service calls” is not necessary; it is enough to have an application with the appropriate permissions set. Don’t forget to complete the Administrator consent.

 

2.      Setting up the infrastructure to push the Office 365 activities

The first step is to push the information you need to a store. We’ll use this sample from GitHub https://github.com/OfficeDev/O365-ActivityFeed-AzureFunction that allow you to push the past seven days of Office 365 Activity data to an instance of Azure Cosmos DB. You can limit the number of days and the workloads as needed. The code is created to run in two Azure Functions (PowerShell is currently in preview).

  • Azure Function 1 places activity messages in a cloud message queue.
  • Azure Function 2 picks up messages from that queue and transmits them to Azure Cosmos DB.

 

     1.      Create Function 1. (QueueEvents.ps1)

Remember to register a new Application in Azure Active Directory with adequate permissions before you take these steps.

 

If you don’t already have a Function App start to create one. By default, runtime is limited to 5 minutes for the functions running under the consumption plans, however, you can increase the runtime up to 10 minutes. An alternative is to use the App Consumption plan if you expect longer execution times. The consumption plans typically cover the need for retrieving the event data.

 

01.png

  

Create a New Function in the Function App

 

02.png

  

Enable experimental Language support, select Timer trigger and PowerShell.

 

03.png

  

Name the new function, and select the schedule for the trigger, which determines how often the function will pull data. A workload.log file is used to keep track of time to prevent duplicate requests.

 

04.png

 

Next, paste the code for function 1., QueueEvents.ps1 to the function.

Adjust the variables for sign in based on the AAD application registered. The Tenant GUID can be found under the Endpoints in the app registration. It is listed as part of the endpoints.

 

05.png

  

We will come back to adjust the storage variables shortly as part of the integration of the storage queues. Optionally modify the included workloads or message size. Note that reducing message size will increase the number of times Azure Function 2 is run. Making message size too large (for example, > 100) may cause you to exceed the limits of the queue and reduce performance.

 

06.png

  

Next, select integrate and add an Azure Queue Storage output. The queue name is specified using the $storageQueue variable use ‘outQueue’with single quotes unless you changed the queue name in the output settings. Click, Show Value on the "Storage account connection" and copy the Account key value to $StorageAccountKey and the AccountName to $StorageAccountName. These steps are required to use cloud queue functionality. A regular storage queue call does not allow for multiple objects.

 

07.png

 

Do verify that the queue was created, there have been some instances in the testing where they weren’t. In that case create a queue manually in the associated storage account.

 

08.png

 

     2.      Create Function 2. (StoreEvents.ps1)

Follow these steps to create the second function, which is a Queue trigger. Create a new Function in the previously created Function App.  Provide a Queue name and the storage account defined in Function 1.

 

09.png

 

Add the code StoreEvents.ps1 and the information for the auth variables. The $triggerInput variable is the message parameter name.

 

10.png 

 

Select Integrate and add a Cosmos DB. The $outputdocument variable is based on the Document parameter name. If you change the name, you must also change the name of the variable. Click Show Value for “Azure Cosmos DB account connection” and store the account key for making requests from Power BI (an alternative is to navigate to the Cosmos DB and use a read-only key).

If you don’t already have an Azure Cosmos DB in place create a new database before creating the output. If you don’t have a Cosmos DB and collection, ensure to set the checkbox to create the Azure Cosmos DB and collection.

 

11.png

 

     3.      Start the functions.

If you haven’t enabled the Office 365 Activity API subscriptions that is the first step to take. There is a sample script for how to enable the subscriptions at the GitHub page it can be run from on-premises (Enablesubscription.ps1). Do enable Office 365 audit log search as well.

 

When configuring a start date for retrieving data, note that the maximum time span is the past 7 days based on Activity API restrictions.

 

If you change variable $StoredTime = Get-content $Tracker to a date in the format of "yyyy-MM-ddTHH:mm:ss.fffZ" the workloads will use it as the starting point (e.g., $StoredTime = "2018-04-12T01:34:18.702Z"). Either disable the function after it has completed a first run or replace it with Get-content $Tracker as the next scheduled run will process the same data if not adjusted.

 

Alternatively, you can use Azure Storage Explorer and add these files with your desired start time to the root of the Azure functions blob store:

  • Audit.AzureActiveDirectory.log
  • Audit.SharePoint.log
  • Audit.Exchange.log
  • Audit.General.log
  • DLP.All.log

The only thing you need in the file is the date example "2018-03-27T11:34:18.702Z" without the quotation marks. The log files allow for continuous synch excluding content previously synchronized.

 

 12.png

 

When the functions are started, invocation logs will indicate if there are any issues. Use Azure Storage Explorer to view the storage queues.

 

If the function for some reason breaks the workload.log files will not be updated, and the function will start from the date last stamped in the workload.log file. There may be some overlap, but the analysis tools will identify any duplicates.

 

Ensure that the data is reaching your Cosmos DB instance by navigating to the Database, as shown below.

 

13.png

 

3.      Open the data in Power BI

Download the Power BI Desktop client and the ZoomCharts referenced previously. Select to connect to Azure Cosmos DB in the Power BI desktop client.

 

15.png

 

Specify your connection string, etc., and optionally specify a query to limit the scope to the asset you want to investigate. Do remember that everything is case sensitive. In this case I have scoped it down to a specific site. Please see the GitHub page for more query samples. The subsequent step will require the Cosmos DB storage key that you stored as part of setting up the Cosmos DB.

 16.png

 

Expand the columns by selecting the expand arrows. When done close and apply.

 

  17.png

 

Import the Zoomchart visual if you haven’t completed that step previously.

  18.png

 

Load the Nodes you want to review and the Measure.

 19.png

 

Change the Measure to count to make the node sizes reflect the actual number of occurrences as an example

 

 20.png

 

In many cases you can export csv files or directly make relationships to existing data and join it with the activity data. This is an example where we imported a few admin accounts from adminlist.csv. It could just as well be a number of files or ip addresses for which you need more information. We loaded the csv file.

 21.png

 

In the next step we went to Relationships and joined the Adminlist with the UserID field to allow us to eliminate all accounts but those we are investigating.

 

22.png

 

In the visual level filter, we removed any account but those we are investigating

 

 23.png

 

Summary

We have provided you with a starting point for how to analyze Office 365 Data using Power BI. The data can be pivoted and analyzed in many ways. Templates and continuously pulling the Activity Data can be used to quickly load data and draw conclusions from the wealth of information. Other event sources such as on premises Intrusion Detection Systems, Information classification systems or Azure Information Protection may be used to join with the activity data to improve visibility.

 

Our next post will provide more examples of analyzing information using Graphs.

 

If you have any feedback please provide it at the GitHub project page or by emailing it to cxprad@microsoft.com.

 

We look forward to hearing from you!

—Jon Nordstrom, senior program manager, Office 365 customer experience

 

12 Comments
Respected Contributor

@Anthony Smith (A.J.)When i register the app in Azure AD, there are duplicate permissions shown. Can you tell me why or which ones to use?

 

Read threat intelligence data for your organization
Read activity reports for your organization
Read threat intelligence data for your organization
Read activity reports for your organization
Microsoft

Hi Dean, thank you for reaching out. The "Read activity data for your organization" will grant you the permissions needed to read and publish the activity data.

Occasional Visitor

I am not seeing anyway in Azure to use Powershell for these scripts. My only options are Java, Javascript and C#.

 

Through the Azure interface at least.

 

Thoughts?

Microsoft

Hi Tony, PowerShell is still in experimental language support.  When you are creating the Function ensure to enable experimental language support and you will find PowerShell as an option. 

 

I hope that it works out well.

 

Occasional Visitor

@Jon Nordström Thanks for the note. Unfortunately that toggle to enable experimental language support does not show for me for some reason.

Microsoft

It may be that you are using the V2 engine where the experimental languages aren't available. Try to configure your Azure function to use 1.x it should allow you to specify the experimental language.

Occasional Visitor

@Jon Nordström... that worked a treat.

 

In case anybody else cannot find the settings mentioned above here is what I did to set my function to 1.x.

 

I clicked on Function Apps on the left hand menu.

 

Then I clicked on the function app in question.

 

I then clicked on Platform features (tab).

 

Under General Settings I clicked "Application Settings".

 

I then scrolled down to Application Settings and chose to Show Values.... I changed to value for FUNCTIONS_EXTENSION_VERSION from ~2 to ~1.

 

 

 

Senior Member

I seem to get lost on the start function section.

 

You state run EnableSubscriptions.ps1, in the repo, there are two.  One in the investigations folder (where your other scripts have come from) and one at the root, where your link goes.  The one at the root needs a webhookurl, which web hook?  Neither work as they don't have a http response any more.

 

 

Microsoft

Thank you Steve for reaching out, I originally set this up using webhooks but found that the option I have with a timer function and cloud message queues are more performant. I still kept the WebHook code in there, since it may be useful for some scenarios.

 

The EnableSubscriptions.ps1 in the investigations folder is starting the subscriptions needed for the scheduled function. Please use the blog post steps to set the timer function up, I never created a dedicated .md for that config.

 

The one in the  root works with the description I have in readme.md

 

If you stick to the description on the repo and use https://github.com/OfficeDev/O365-ActivityFeed-AzureFunction/blob/master/ActivityFunctionApp.ps1 you can use the webhook function. Which is enabled by EnableSubscriptions.ps1 in the root. Steps to Create the Azure Function”

 

Sorry for the confusion,

Jon

Senior Member

@Jon Nordstrom thanks for the clarity.

Senior Member

It seems from the opening statements that there is clear and strong impetus for this being a product feature, not an example.

 

Any movement toward always having this stuff available somewhere like the above, or Kusto, with a powerful, query-able endpoint for Power BI? Then the portal could have a the simplified query tool on top of that power.

 

Thanks,

Eric

 

Occasional Visitor

Great article guys, thanks for sharing! It worked perfectly for me. Now I'm using it with Dynamics 365 Customer Engagement and the Power Platform.