# Log Analytics

{% hint style="info" %}
An Azure App Registration is required to connect and grant ClearInsights **read** access into your log analytics workspace.
{% endhint %}

### Creating An Azure App Registration

1. Go To App Registration Service: Search for and navigate to Azure's App Registration service. This can be done by navigating to All Services page or searching via Azure portals main search bar.
2. Create An App Registration: From the App Registration service > click on *New Registration*.&#x20;
   * Add a name for this App Registration. *(Suggested Name: ClearInsights Log Managment)*
   * Choose Supported Account Type *(Recommended: Accounts in this organizational directory only)*

It's recommended to create a new app registration as the **sole purpose** of this app registration is to grant ClearInsights **read only** access to the desired Log Analytics Workspaces.

### Connect ClearInsights to App Registration

1. Grab your Tenant ID: [How to find your Azure Tenant ID?](https://learn.microsoft.com/en-us/azure/active-directory/fundamentals/active-directory-how-to-find-tenant)
2. Get Your App Client ID: From the Overview tab on your Azure App Registration - copy & paste the value of **Application (client) ID** into the ClearInsights **Log Analytics Workspace** form.
3. Get Your Client Secret: From the Certificates & Secrets tab on your Azure App Registration - Create a new client secret and copy & paste the secret value into the ClearInsights **Log Analytics Workspace** form.
4. Get Your Log Analytics Workspace ID: In Azure, go to Log Analytics workspaces > Select Workspace and then "Overview" tab. From here you can retrieve a **Workspace ID**. Copy & paste this Workspace ID into the ClearInsights Log Analytics Workspace form.

### Grant App Registration access to Log Analytics Workspace

1. Go To Log Analytics workspaces Service: Search for and navigate to Azure's Log Analytics workspaces service. This can be done by navigating to All Services page or searching via Azure portals main search bar.
2. Select the workspace: You may have more than 1 workspace available in this list, most likely separated by environment or resource group. Select the appropriate workspace(s) that contain the logs that you'd like to ingest into ClearInsights.
3. Grant Access: From the Access control (IAM) blade > Select the "Role assignments" tab.&#x20;
   1. Click on "Add role assignment" under the Add menu.
   2. Select "Reader" from the Role tab.
   3. Assign access to *User, group, or service principal*
   4. Members: Click select members > Search for the name of the App Registration created above *(Suggested Name: ClearInsights Log Managment)*
   5. Save: Click "Review + Assign". Your app registration should now have read access to this log analytics workspace.

### Additional Resources

{% embed url="<https://learn.microsoft.com/en-us/azure/active-directory/fundamentals/active-directory-how-to-find-tenant>" %}

{% embed url="<https://learn.microsoft.com/en-us/azure/azure-monitor/logs/quick-create-workspace?tabs=azure-portal>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.clearinsights.io/clearinsights-integrations/cloud-management-integrations/azure/log-analytics.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
