ערוך

שתף באמצעות


Azure Monitor Logs extension for Azure Data Studio (Preview)

The Azure Monitor Logs extension for Azure Data Studio enables you to connect and query a Log Analytics workspace.

This extension is currently in preview.

Prerequisites

If you don't have an Azure subscription, create a free Azure account before you begin.

The following prerequisites are also required:

Install the Azure Monitor Logs extension

To install the Azure Monitor Logs extension in Azure Data Studio, follow the steps below.

  1. Open the extensions manager in Azure Data Studio. You can either select the extensions icon or select Extensions in the View menu.

  2. Type in Monitor logs in the search bar.

  3. Select the Azure Monitor Logs extension and view its details.

  4. Select Install.

Kusto extension

How to connect to a Log Analytics workspace

Find your Log Analytics workspace

Find your Log Analytics Workspace in the Azure portal, then find the Workspace ID.

Azure Monitor Logs Workspace ID

Connection details

To set up an Azure Monitor Log workspace, follow the steps below.

  1. Select New connection from the Connections pane.

  2. Fill in the Connection Details information.

    1. For Connection type, select Azure Monitor Logs.
    2. For Workspace ID, enter in your Log Analytics Workspace ID.
    3. For Authentication type, use the default - Azure Active Directory - Universal with MFA account.
    4. For Account, use your account information.
    5. For Database, select the same Workspace ID.
    6. For Server group, use Default.
      1. You can use this field to organize your servers in a specific group.
    7. For Name (optional), leave blank.
      1. You can use this field to give your server an alias.

    Connection details

How to query a Log Analytics Workspace in Azure Data Studio

Now that you have set up a connection to your Log analytics workspace, you can query the workspace using Kusto (KQL).

To create a new query tab, you can either select File > New Query, use Ctrl + N, or right-click the database and select New Query.

Once you have your new query tab open, then enter your Kusto query.

There are two main tables in Azure Log Analytics (Azure Monitor Logs) workspace that capture Azure SQL events for an Azure SQL database:

  1. AzureDiagnostics
  2. AzureMetric

To execute the samples below, you must be logged in to an Azure SQL database.

Here are some samples of KQL queries:

AzureDiagnostics
| summarize count() by OperationName
AzureDiagnostics
| where LogicalServerName_s == "<servername>"
| summarize count() by Category

Note

Allow about 15 minutes before the log results appear.

For more information about writing Azure Monitor Logs, visit Azure Monitor documentation

Next steps