Use an Azure Function to add information to Log Analytics

This is an example how to add information from an Azure Function to Log Analytics with C#. I have used the C# code from the Log Analytics documentation and made some changes to fit my needs.

In this example I have chosen to use an http trigger and let the Function to take an json input. The input data is then added into the Log Analytics workspace.

Use an Azure Function to add information to Log Analytics1

Create an Azure Function as a HTTP trigger.

Use an Azure Function to add information to Log Analytics2

Paste the following code and replace the variables LogAnalyticsWorkspaceId and LogAnalyticsWorkspaceKey.

Add test json code in the “Request body” and test the Function by clicking Run.

Use an Azure Function to add information to Log Analytics3

 

No comments yet.

Leave a Reply