Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion data-explorer/kusto/api/connection-strings/kusto.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Kusto connection strings
description: This article describes Kusto connection strings.
ms.reviewer: ygilad
ms.topic: reference
ms.date: 11/23/2025
ms.date: 11/25/2025
ms.custom: sfi-ropc-nochange
---
# Kusto connection strings
Expand Down Expand Up @@ -146,6 +146,9 @@ The following examples show how to set up connections using C#. For examples in
The following example shows how to set up a connection to a Kusto service using Microsoft Entra ID for federated authentication. The user is prompted for credentials, when necessary.

```csharp
using Kusto.Data;


var kustoUri = "https://<clusterName>.<region>.kusto.windows.net";
var authority = "contoso.com"; // Or the AAD tenant GUID
var kustoConnectionStringBuilder = new KustoConnectionStringBuilder(kustoUri)
Expand All @@ -158,6 +161,8 @@ var kustoConnectionStringBuilder = new KustoConnectionStringBuilder(kustoUri)
The following example shows how to set up a connection to a Kusto service using Microsoft Entra ID for federated authentication and prefills the user's identity using the `userID` variable. The user is prompted for credentials, when necessary.

```csharp
using Kusto.Data;

var kustoUri = "https://<clusterName>.<region>.kusto.windows.net";
var authority = "contoso.com"; // Or the AAD tenant GUID
var userId = "johndoe@contoso.com";
Expand All @@ -171,6 +176,8 @@ var kustoConnectionStringBuilder = new KustoConnectionStringBuilder(kustoUri)
The following example shows how to authenticate to a Kusto service using Microsoft Entra ID for federated authentication with an application client ID and key.

```csharp
using Kusto.Data;

var kustoUri = "https://<clusterName>.<region>.kusto.windows.net";
var appId = "<appId>";
var appKey = "<appKey>";
Expand All @@ -185,6 +192,8 @@ var kustoConnectionStringBuilder = new KustoConnectionStringBuilder(kustoUri)
The following example shows how to authenticate to a Kusto service using a system-assigned Managed Identity for authentication.

```csharp
using Kusto.Data;

var kustoUri = "https://<clusterName>.<region>.kusto.windows.net";
var kustoConnectionStringBuilder = new KustoConnectionStringBuilder(kustoUri)
.WithAadSystemManagedIdentity();
Expand All @@ -195,6 +204,8 @@ var kustoConnectionStringBuilder = new KustoConnectionStringBuilder(kustoUri)
The following example shows how to authenticate to a Kusto service using a user-assigned Managed Identity for authentication.

```csharp
using Kusto.Data;

var kustoUri = "https://<clusterName>.<region>.kusto.windows.net";
var managedIdentityClientId = "<managedIdentityClientId>";
var kustoConnectionStringBuilder = new KustoConnectionStringBuilder(kustoUri)
Expand All @@ -206,6 +217,8 @@ var kustoConnectionStringBuilder = new KustoConnectionStringBuilder(kustoUri)
The following example shows how to set up a connection to a Kusto service using Microsoft Entra ID with either a user access token or an application access token.

```csharp
using Kusto.Data;

var kustoUri = "https://<clusterName>.<region>.kusto.windows.net";
var userAccessToken = "<userAccessToken>";
var appAccessToken = "<appAccessToken>";
Expand All @@ -226,6 +239,8 @@ var kustoConnectionStringBuilder = new KustoConnectionStringBuilder(kustoUri)
The following example shows how to authenticate to a Kusto service using Microsoft Entra ID with a custom token provider callback. The token is invoked each time a token is required.

```csharp
using Kusto.Data;

var kustoUri = "https://<clusterName>.<region>.kusto.windows.net";
Func<string> tokenProviderCallback; // User-defined method to retrieve the access token
var kustoConnectionStringBuilder = new KustoConnectionStringBuilder(kustoUri)
Expand All @@ -237,6 +252,8 @@ var kustoConnectionStringBuilder = new KustoConnectionStringBuilder(kustoUri)
The following example shows how to authenticate to a Kusto service using Microsoft Entra ID for federated authentication with an application certificate.

```csharp
using Kusto.Data;

var kustoUri = "https://<clusterName>.<region>.kusto.windows.net";
var appId = "<appId>";
X509Certificate2 appCert;
Expand All @@ -251,6 +268,8 @@ var kustoConnectionStringBuilder = new KustoConnectionStringBuilder(kustoUri)
The following example shows how to set up a connection to a Kusto service using Microsoft Entra ID with an application certificate thumbprint. The client attempts to load the certificate from a local store.

```csharp
using Kusto.Data;

var kustoUri = "https://<clusterName>.<region>.kusto.windows.net";
var appId = "<appId>";
var appCert = "<appCert>";
Expand All @@ -259,6 +278,7 @@ var kustoConnectionStringBuilder = new KustoConnectionStringBuilder(kustoUri)
.WithAadApplicationThumbprintAuthentication(appId, appCert, authority);
// Equivalent Kusto connection string: $"Data Source={kustoUri};Database=NetDefaultDB;Fed=True;AppClientId={appId};AppCert={appCert};Authority Id={authority}"
```

::: moniker-end
:::moniker range="microsoft-fabric"

Expand All @@ -267,6 +287,8 @@ var kustoConnectionStringBuilder = new KustoConnectionStringBuilder(kustoUri)
The following example shows how to set up a connection to a Kusto service using Microsoft Entra ID for federated authentication. The user is prompted for credentials, when necessary.

```csharp
using Kusto.Data;

var kustoUri = "serviceURI";
var authority = "contoso.com"; // Or the AAD tenant GUID
var kustoConnectionStringBuilder = new KustoConnectionStringBuilder(kustoUri)
Expand All @@ -279,6 +301,8 @@ var kustoConnectionStringBuilder = new KustoConnectionStringBuilder(kustoUri)
The following example shows how to set up a connection to a Kusto service using Microsoft Entra ID for federated authentication and prefills the user's identity using the `userID` variable. The user is prompted for credentials, when necessary.

```csharp
using Kusto.Data;

var kustoUri = "serviceURI";
var authority = "contoso.com"; // Or the AAD tenant GUID
var userId = "johndoe@contoso.com";
Expand All @@ -292,6 +316,8 @@ var kustoConnectionStringBuilder = new KustoConnectionStringBuilder(kustoUri)
The following example shows how to authenticate to a Kusto service using Microsoft Entra ID for federated authentication with an application client ID and key.

```csharp
using Kusto.Data;

var kustoUri = "serviceURI";
var appId = "<appId>";
var appKey = "<appKey>";
Expand All @@ -306,6 +332,8 @@ var kustoConnectionStringBuilder = new KustoConnectionStringBuilder(kustoUri)
The following example shows how to set up a connection to a Kusto service using Microsoft Entra ID with either a user access token or an application access token.

```csharp
using Kusto.Data;

var kustoUri = "serviceURI";
var userAccessToken = "<userAccessToken>";
var appAccessToken = "<appAccessToken>";
Expand All @@ -326,6 +354,8 @@ var kustoConnectionStringBuilder = new KustoConnectionStringBuilder(kustoUri)
The following example shows how to authenticate to a Kusto service using Microsoft Entra ID with a custom token provider callback. The token is invoked each time a token is required.

```csharp
using Kusto.Data;

var kustoUri = "serviceURI";
Func<string> tokenProviderCallback; // User-defined method to retrieve the access token
var kustoConnectionStringBuilder = new KustoConnectionStringBuilder(kustoUri)
Expand All @@ -337,6 +367,8 @@ var kustoConnectionStringBuilder = new KustoConnectionStringBuilder(kustoUri)
The following example shows how to authenticate to a Kusto service using Microsoft Entra ID for federated authentication with an application certificate.

```csharp
using Kusto.Data;

var kustoUri = "serviceURI";
var appId = "<appId>";
X509Certificate2 appCert;
Expand All @@ -351,6 +383,8 @@ var kustoConnectionStringBuilder = new KustoConnectionStringBuilder(kustoUri)
The following example shows how to set up a connection to a Kusto service using Microsoft Entra ID with an application certificate thumbprint. The client attempts to load the certificate from a local store.

```csharp
using Kusto.Data;

var kustoUri = "serviceURI";
var appId = "<appId>";
var appCert = "<appCert>";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,23 +98,10 @@ import (
"github.com/Azure/azure-kusto-go/azkustodata/trustedEndpoints"
)

// Add a DNS domain
trustedEndpoints.Instance.AddTrustedHosts([]trustedEndpoints.MatchRule{
security.NewMatchRule(".domain.com", false),
})

// Add a fully qualified domain name
trustedEndpoints.Instance.AddTrustedHosts([]trustedEndpoints.MatchRule{
security.NewMatchRule("mykusto.domain.com", true),
})

// Set a custom validation policy
trustedEndpoints.Instance.SetOverrideMatcher(
func(h string) bool {
return true
},
security.KustoTrustedEndpoints.KustoEndpointContext,
)
// Due to an issue in Go SDK, the only available bypass option in old versions is to provide a custom policy
// For simplicity, the suggestion is to blank allow requests, until an SDK upgrade is possible
// This doc will be updated when a fixed version is available
trustedEndpoints.Instance.SetOverridePolicy( func(s string) bool { return true} )

```

Expand Down Expand Up @@ -144,16 +131,16 @@ KustoTrustedEndpoints.setOverridePolicy(

```javascript

import { KustoTrustedEndpoints, MatchRule } from "azure.kusto.data";
import { kustoTrustedEndpoints, MatchRule } from "azure.kusto.data";

// Add a DNS domain
KustoTrustedEndpoints.addTrustedHosts([new MatchRule(".domain.com", false)]);
kustoTrustedEndpoints.addTrustedHosts([new MatchRule(".domain.com", false)]);

// Add a fully qualified domain name
KustoTrustedEndpoints.addTrustedHosts([new MatchRule("mykusto.domain.com", true)]);
kustoTrustedEndpoints.addTrustedHosts([new MatchRule("mykusto.domain.com", true)]);

// Set a custom validation policy
KustoTrustedEndpoints.setOverrideMatcher(
kustoTrustedEndpoints.setOverrideMatcher(
(h) => true,
KustoTrustedEndpoints.KustoEndpointContext
);
Expand All @@ -164,16 +151,16 @@ KustoTrustedEndpoints.setOverrideMatcher(

```python

from azure.kusto.data.security import KustoTrustedEndpoints, MatchRule
from azure.kusto.data.security import well_known_kusto_endpoints, MatchRule

# Add a DNS domain
KustoTrustedEndpoints.add_trusted_hosts([MatchRule(".domain.com", exact=False)])
well_known_kusto_endpoints.add_trusted_hosts([MatchRule(".domain.com", exact=False)])

# Add a fully qualified domain name
KustoTrustedEndpoints.add_trusted_hosts([MatchRule("mykusto.domain.com", exact=True)])
well_known_kusto_endpoints.add_trusted_hosts([MatchRule("mykusto.domain.com", exact=True)])

# Set a custom validation policy
KustoTrustedEndpoints.set_override_matcher(
well_known_kusto_endpoints.set_override_matcher(
lambda h: True,
KustoTrustedEndpoints.KustoEndpointContext)

Expand Down