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)

To connect to Azure Data Explorer from Azure Data Studio, follow these steps.

  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 Azure Active Directory - Universal with MFA support.

  4. Specify the account that is provisioned in the Azure AD. 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, follow these steps.

  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, you can create a connection to the Azure Data Explorer database by doing the following actions.

  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.

    Warning

    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, follow these steps.

  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 Azure Active Directory - 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.

    Note

    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.

MATLAB

From MATLAB, you can connect to Azure Data Explorer using JDBC. To connect, do the following:

  1. Create a "javaclasspath.txt" file in your preferences directory. This file will be used to add the required JAR-files to the front of MATLAB's static classpath.

    edit(fullfile(prefdir,'javaclasspath.txt'))
    
  2. Add the paths to the required JAR-files by replacing c:\full\path\to with the actual full paths to these files.

    <before>
    c:\full\path\to\accessors-smart-1.2.jar
    c:\full\path\to\activation-1.1.jar
    c:\full\path\to\adal4j-1.6.3.jar
    c:\full\path\to\asm-5.0.4.jar
    c:\full\path\to\commons-codec-1.11.jar
    c:\full\path\to\commons-lang3-3.5.jar
    c:\full\path\to\gson-2.8.0.jar
    c:\full\path\to\javax.mail-1.6.1.jar
    c:\full\path\to\jcip-annotations-1.0-1.jar
    c:\full\path\to\json-smart-2.3.jar
    c:\full\path\to\lang-tag-1.4.4.jar
    c:\full\path\to\mssql-jdbc-7.0.0.jre8.jar
    c:\full\path\to\nimbus-jose-jwt-6.5.jar
    c:\full\path\to\oauth2-oidc-sdk-5.64.4.jar
    c:\full\path\to\slf4j-api-1.7.21.jar
    

    Important

    You need the <before> at the top, so that these files are added to the front of the classpath.

  3. Restart MATLAB to make sure that these classes are loaded.

  4. In the MATLAB command window, run the following command to reset TransformerFactory to the default. MATLAB usually overloads this with Saxon, which is incompatible with the adal4j dependency.

    java.lang.System.clearProperty('javax.xml.transform.TransformerFactory')
    
  5. In the MATLAB command window, run the following command to connect to Azure Data Explorer.

    conn = database('<database_name>','<AAD_user>','<AAD_user_password>','com.microsoft.sqlserver.jdbc.SQLServerDriver' ['jdbc:sqlserver://<cluster_name.region>.kusto.windows.net:1433;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.kusto.windows.net;loginTimeout=30;authentication=ActiveDirectoryPassword;database='])
    

    Note

    • If you end with database= without a value, the database name will be inferred.
    • To use Azure Active Directory integrated authentication, replace ActiveDirectoryPassword with ActiveDirectoryIntegrated.
  6. In the MATLAB command window, test the connection and run a sample T-SQL query. Replace <table_name> with an existing table in Azure Data Explorer.

    data = select(conn, 'SELECT * FROM <table_name>')
    data
    

Next steps