Skaityti anglų kalba Redaguoti

Bendrinti naudojant


Connect from common apps

This article gives examples on how to connect to Azure Data Explorer from LINQPad, Azure Data Studio, DBeaver, and Microsoft SQL Server Management Studio.

For more information, see the overview on SQL Server emulation in Azure Data Explorer.

LINQPad

You can connect to Azure Data Explorer from LINQPad as if Azure Data Explorer were an SQL server.

  1. Select Add connection.

  2. Set Build data context automatically.

  3. Set Default (LINQ to SQL), the LINQPad driver.

  4. Set SQL Azure.

  5. For the server, specify the name of the Azure Data Explorer cluster. For example, mykusto.kusto.windows.net.

  6. Set Windows Authentication (Active Directory), for signing in.

  7. Select Test to verify connectivity.

  8. Select OK. The browser window displays the tree view with the databases.

  9. Now, you can browse through the databases, tables, and columns, and run SQLand LINQ queries in the query window. Specify the SQL language, and select a connection to the database. For example, select a table in the browser window. Select Count, and let it run.

Azure Data Studio (1.3.4 and above)

You can connect to Azure Data Explorer from Azure Data Studio as if Azure Data Explorer were an SQL server.

  1. Set the connection type to Microsoft SQL Server.

  2. Specify the name of the Azure Data Explorer cluster as a server name. For example, mykusto.kusto.windows.net.

  3. Set the authentication type Microsoft Entra ID - Universal with MFA support.

  4. Specify the account that is provisioned in the Microsoft Entra ID. For example, myname@contoso.com. Add the account the first time.

  5. Use Database picker to select the database.

  6. Select Connect to take you to the database dashboard and set the connection.

  7. Select New Query to open the query window, or select the New Query task on the dashboard.

DBeaver (5.3.3 and above)

To configure DBeaver for handling result sets in a manner that is compatible with Azure Data Explorer:

  1. Select Preferences in the Window menu.
  2. Select Data Editor in the Editors section.
  3. Make sure that Refresh data on next page reading is marked.

Now, connect to Azure Data Explorer from DBeaver as if Azure Data Explorer were an SQL server:

  1. Select New Connection in the Database menu.

  2. Look for Azure and set Azure SQL Database. Select Next.

  3. Specify the host. For example, mykusto.kusto.windows.net.

  4. Specify the database. For example, mydatabase.

    Įspėjimas

    Don't use master as the database name. Azure Data Explorer requires a connection to a specific database.

  5. Set Active Directory - Password for Authentication.

  6. Specify the credentials of the active directory user. For example, myname@contoso.com, and set the corresponding password for this user.

  7. Select Test Connection … to verify that the connection details are correct.

Microsoft SQL Server Management Studio (v18.x)

To connect to Azure Data Explorer from Microsoft SQL Server Management Studio:

  1. Select Connect, and then Database Engine under Object Explorer.

  2. Specify the name of Azure Data Explorer cluster as a server name. For example, mykusto.region.kusto.windows.net.

  3. Set Microsoft Entra ID - Universal with MFA for authentication and specify the username.

  4. Select Options.

  5. Select Browse Server under Connect to database to browse available databases.

  6. Select Yes to continue browsing.

  7. The window displays a tree view with all the available databases. Select a database to connect to that database. Another possibility, is to select default under Connect to database, and then select Connect. Then, the object Explorer will display all the databases.

    Pastaba

    Browsing database objects via SSMS is not supported yet, since SSMS uses correlate subqueries to browse database schema. Correlated subqueries are not supported by Azure Data Explorer. For more information, see correlated subqueries.

  8. Select New Query to open the query window and set your database.

  9. Now, you can run custom SQL queries from the query window.

PowerShell

The following example shows how to connect to your cluster using an ODBC driver in PowerShell using a connection string.

$conn = [System.Data.Common.DbProviderFactories]::GetFactory("System.Data.Odbc").CreateConnection()
$conn.ConnectionString = "Driver={ODBC Driver 17 for SQL Server};Server=mykustocluster.kusto.windows.net;Database=mykustodatabase;Authentication=ActiveDirectoryIntegrated"
$conn.Open()
$conn.GetSchema("Tables")
$conn.Close()