Home
%3CLINGO-SUB%20id%3D%22lingo-sub-558896%22%20slang%3D%22en-US%22%3ESending%20REST%20API%20data%20to%20Azure%20Sentinel%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-558896%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3EDuring%20a%20recent%20customer%20conversation%2C%20a%20use%20case%20was%20brought%20up%20for%20sending%20REST%20API%20data%20to%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fsentinel%2Foverview%22%20target%3D%22_self%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Sentinel.%3C%2FA%3E%20This%20customer%20had%20several%20applications%20and%20services%20that%20only%20have%20a%20REST%20API%20available%2C%20so%20the%20out%20of%20the%20box%20Azure%20Sentinel%20connectors%20where%20not%20able%20to%20cover%20that.%20The%20design%20goal%20of%20the%20Azure%20Sentinel%20connectors%20is%20to%20connect%20data%20sources%20with%20a%20couple%20of%20clicks.%20This%20doesn%E2%80%99t%20mean%20that%20we%20stop%20there%20and%20that%20you%20cannot%20go%20beyond%20the%20available%20connectors.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3ESince%20Azure%20Sentinel%20is%20based%20on%20a%20workspace%20(formerly%20known%20as%20an%20OMS%20workspace)%2C%20data%20can%20be%20sent%20to%20a%20workspace%20leveraging%20a%20couple%20of%20ways.%20The%20most%20known%20and%20common%20way%20is%20via%20the%20Microsoft%20Management%20Agent%20(MMA)%20which%20can%20collect%20a%20variety%20of%20data.%20Less%20known%20is%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fazure-monitor%2Fplatform%2Fdata-collector-api%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EHTTP%20Data%20Collector%20API%3C%2FA%3E.%20This%20enables%20you%20to%20send%20%3CEM%3Eany%3C%2FEM%3E%20data%20to%20a%20workspace.%20As%20long%20as%20it%20is%20JSON%20formatted%2C%20it%E2%80%99s%20just%20a%20%E2%80%9CHTTP%20POST%E2%80%9D%20away.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3ESending%20the%20data%20can%20be%20done%20using%20PowerShell%2C%20C%23%2C%20Python%20and%20through%20a%20number%20of%20other%20options.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EAnother%20great%20option%20is%20using%20a%20Logic%20Apps%20Playbook%2C%20which%20I%E2%80%99ve%20demonstrated%20to%20the%20customer%20as%20a%20proof%20of%20concept%20and%20got%20received%20very%20well.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EI%E2%80%99ve%20built%20a%20Logic%20App%20playbook%20leveraging%20a%20%3CSTRONG%3Eweather%20service%3C%2FSTRONG%3E%20called%20%3CA%20href%3D%22https%3A%2F%2Fopenweathermap.org%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3EOpenWeatherMap%3C%2FA%3E.%20They%20have%20a%20free%20version%20you%20can%20test%20with.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EGetting%20REST%20API%20data%20is%20pretty%20easy%20using%20Logic%20Apps.%20You%20add%20a%20trigger%20(like%20a%20schedule)%20and%20add%20a%20HTTP%20building%20block%20to%20your%20playbook.%20From%20the%20OpenWeatherMap%20website%2C%20can%20find%20how%20the%20%3CA%20href%3D%22https%3A%2F%2Fopenweathermap.org%2Fcurrent%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAPI%20call%3C%2FA%3E%20is%20constructed%20and%20use%20that%20in%20the%20URI%20field%20of%20the%20HTTP%20building%20block%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20620px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F112951iD899316B35CDC64A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22LogicAppWeather.png%22%20title%3D%22LogicAppWeather.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EAfter%20the%20API%20has%20returned%20the%20data%2C%20you%20can%20use%20it%20anywhere%20in%20your%20playbook.%20For%20sending%20it%20to%20the%20Azure%20Sentinel%20workspace%20we%20need%20to%20parse%20the%20data%20first.%20For%20this%20we%20leverage%20a%20%3CSTRONG%3EParse%20JSON%3C%2FSTRONG%3E%20building%20block%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20609px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F112953iF81A2BCE54B2EFC9%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22LogicAppWeather2.png%22%20title%3D%22LogicAppWeather2.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EFor%20the%20schema%2C%20you%20click%20on%20the%20link%20%E2%80%9C%3CEM%3EUse%20sample%20payload%20to%20generate%20schema%3C%2FEM%3E%E2%80%9D%20and%20paste%20in%20the%20body%20results%20of%20the%20API%20call%20into%20the%20schema%20section.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EFrom%20there%20you%20can%20do%20whatever%20you%20want%20with%20the%20data.%20You%20can%20send%20it%20via%20email%2C%20post%20it%20on%20a%20website%2C%20or%20in%20our%20case%2C%20send%20it%20to%20the%20Azure%20Sentinel%20workspace.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3ETo%20send%20it%2C%20you%20can%20leverage%20and%20configure%20the%20Azure%20Log%20Analytics%20building%20block%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20671px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F112954i259DCE7460138B9F%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22workspaceConnection.png%22%20title%3D%22workspaceConnection.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSPAN%3EConfigure%20your%20connection%20and%20provide%20the%20workspaceId%20and%20workspaceKey%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%3ELeverage%20the%20%E2%80%9CParse%20JSON%E2%80%9D%20output%20as%20input%20(JSON%20Request%20Body)%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CSPAN%3EDefine%20a%20custom%20log%20name%20(like%20Weather)%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EAfter%20the%20playbook%20has%20run%20according%20your%20schedule%2C%20the%20data%20can%20be%20found%20in%20the%20Azure%20Sentinel%20workspace%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20718px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F112955i257BDA67037ED89F%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22Weather_CL.png%22%20title%3D%22Weather_CL.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3ENow%20that%20the%20data%20is%20in%20the%20Azure%20Sentinel%20workspace%2C%20you%20can%20%E2%80%9Cjoin%E2%80%9D%20it%20with%20any%20other%20data%20to%20do%20correlation%2C%20execute%20hunting%20queries%20or%20even%20build%20an%20analytics%20alert%20rule%20on%20top%20of%20it.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3ELet%E2%80%99s%20take%20our%20Azure%20Activity%20logs.%20This%20contains%20amongst%20others%2C%20sign-in%20information%20like%20location%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20553px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F112958iFF83905A54744941%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22location.png%22%20title%3D%22location.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EI%20can%20now%20%E2%80%9Cjoin%E2%80%9D%20this%20information%20with%20my%20weather%20information%20which%20I%E2%80%99ve%20sent%20to%20the%20Azure%20Sentinel%20workspace%20by%20running%20a%20simple%20%E2%80%9Cjoin%E2%80%9D%20query%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20847px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F112965i7F8432F0CFBD8C29%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22KustoQueryWeatherJoin.png%22%20title%3D%22KustoQueryWeatherJoin.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EAs%20you%20can%20see%2C%20it%E2%80%99s%20unfortunately%20not%20that%20great%20of%20a%20weather%20in%20the%20Netherlands%20currently%20(the%20value%20of%20%E2%80%9C%3CEM%3Emain_temp_d%3C%2FEM%3E%E2%80%9D%20is%20in%20Celsius).%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EWith%20this%20blogpost%20I%E2%80%99ve%20demonstrated%20how%20you%20can%20send%20%3CSTRONG%3Eany%20REST%20API%20data%3C%2FSTRONG%3E%20to%20Azure%20Sentinel.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-558896%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EREST%20API%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

During a recent customer conversation, a use case was brought up for sending REST API data to Azure Sentinel. This customer had several applications and services that only have a REST API available, so the out of the box Azure Sentinel connectors where not able to cover that. The design goal of the Azure Sentinel connectors is to connect data sources with a couple of clicks. This doesn’t mean that we stop there and that you cannot go beyond the available connectors.

 

Since Azure Sentinel is based on a workspace (formerly known as an OMS workspace), data can be sent to a workspace leveraging a couple of ways. The most known and common way is via the Microsoft Management Agent (MMA) which can collect a variety of data. Less known is the HTTP Data Collector API. This enables you to send any data to a workspace. As long as it is JSON formatted, it’s just a “HTTP POST” away.

 

Sending the data can be done using PowerShell, C#, Python and through a number of other options.

Another great option is using a Logic Apps Playbook, which I’ve demonstrated to the customer as a proof of concept and got received very well.

 

I’ve built a Logic App playbook leveraging a weather service called OpenWeatherMap. They have a free version you can test with.

 

Getting REST API data is pretty easy using Logic Apps. You add a trigger (like a schedule) and add a HTTP building block to your playbook. From the OpenWeatherMap website, can find how the API call is constructed and use that in the URI field of the HTTP building block:

LogicAppWeather.png

 

After the API has returned the data, you can use it anywhere in your playbook. For sending it to the Azure Sentinel workspace we need to parse the data first. For this we leverage a Parse JSON building block:

LogicAppWeather2.png

For the schema, you click on the link “Use sample payload to generate schema” and paste in the body results of the API call into the schema section.

 

From there you can do whatever you want with the data. You can send it via email, post it on a website, or in our case, send it to the Azure Sentinel workspace.

 

To send it, you can leverage and configure the Azure Log Analytics building block:

workspaceConnection.png

  • Configure your connection and provide the workspaceId and workspaceKey
  • Leverage the “Parse JSON” output as input (JSON Request Body)
  • Define a custom log name (like Weather)

 

After the playbook has run according your schedule, the data can be found in the Azure Sentinel workspace:

Weather_CL.png

 

Now that the data is in the Azure Sentinel workspace, you can “join” it with any other data to do correlation, execute hunting queries or even build an analytics alert rule on top of it.

 

Let’s take our Azure Activity logs. This contains amongst others, sign-in information like location:

location.png

 

I can now “join” this information with my weather information which I’ve sent to the Azure Sentinel workspace by running a simple “join” query:

KustoQueryWeatherJoin.png

 

As you can see, it’s unfortunately not that great of a weather in the Netherlands currently (the value of “main_temp_d” is in Celsius).

 

With this blogpost I’ve demonstrated how you can send any REST API data to Azure Sentinel.