In this article, We learn about IcM and kusto. I will try to discuss further as much as I can, and just follow clearly.

For more updates please do Subscribe via Email:

What is IcM?

Microsoft Azure Incident Management System in shorter term is IcM.

IcM is a term describing the activities of an organization to identify, analyze, and correct hazards to prevent a future re-occurrence. If not managed, an incident can escalate into an emergency, crisis or a disaster.

The first goal of the incident management process is to restore a normal service operation as quickly as possible and to minimize the impact on business operations, thus ensuring that the best possible levels of service quality and availability are maintained.

What is Kusto?

Kusto is a query language designed for big data workloads particularly using large amount of data in from things like logs and event sources. Kusto  query is a read-only request to process data and return results. KQL is the first party query language for Kusto cluster used by Azure Data Explorer. Kusto Query is only good for pulling or getting data from the data bank.

For more details about kusto just click the link

Kusto Query Language (KQL)

Data Pull

Let’s Go!.

First you need to install nuget package for kusto connection builder. Just search in nuget package.

to Install this in Package manager console,

Install-Package Microsoft.Azure.Kusto.Data -Version 10.0.1

or refer this link: https://www.nuget.org/packages/Microsoft.Azure.Kusto.Data/

After install this packages, run this code in your IDE.

  • Main Code.
 ClientRequestProperties clientRequestProperties = new ClientRequestProperties() { ClientRequestId = Guid.NewGuid().ToString() };
string tenantId = "--tenant Identifier-";
string icmClusterServiceURI = "-- IcM Cluster Service URI--";
string clientSecret = "--Client--Secret--";
string icmClusterDatabase = "-- IcM Database --";
string ActiveDirectoryClientId = "AAD Client ID";

string query = "---KUSTO QUERY HERE --";

KustoConnectionStringBuilder connectionStr = new KustoConnectionStringBuilder(icmClusterServiceURI + "/" + icmClusterDatabase)
                .WithAadApplicationKeyAuthentication(applicationClientId: ActiveDirectoryClientId,
                                                        applicationKey: clientSecret, authority: tenantId);

var queryProvider = Kusto.Data.Net.Client.KustoClientFactory.CreateCslQueryProvider(connectionStr);

var result = queryProvider.ExecuteQuery<IcMModel>(icmClusterDatabase, query, clientRequestProperties).ToList();

Now the result of this code is List, If you want to change the result into DataTable. You need to change the ToList() into ToDataTable().

var result = queryProvider.ExecuteQuery<IcMModel>(icmClusterDatabase, query, clientRequestProperties).ToDataTable();
  • IcMModel
public class IcMModel
{
  public int Id;
  public string Incident;
  public string Description;
  ….
  ….
  ….
}

If you have question and clarification, please feel free to comment below.

Thank you for visiting my blog site. Hoping you learn more here. please feel free to comment and suggest if there is need to enhance and update. thank you.

Related Topics

Others

Leave a Reply

Your email address will not be published. Required fields are marked *