diff --git a/data-explorer/kusto/api/connection-strings/kusto.md b/data-explorer/kusto/api/connection-strings/kusto.md index d6b29bcfb0..29e9c544fd 100644 --- a/data-explorer/kusto/api/connection-strings/kusto.md +++ b/data-explorer/kusto/api/connection-strings/kusto.md @@ -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 @@ -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://..kusto.windows.net"; var authority = "contoso.com"; // Or the AAD tenant GUID var kustoConnectionStringBuilder = new KustoConnectionStringBuilder(kustoUri) @@ -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://..kusto.windows.net"; var authority = "contoso.com"; // Or the AAD tenant GUID var userId = "johndoe@contoso.com"; @@ -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://..kusto.windows.net"; var appId = ""; var appKey = ""; @@ -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://..kusto.windows.net"; var kustoConnectionStringBuilder = new KustoConnectionStringBuilder(kustoUri) .WithAadSystemManagedIdentity(); @@ -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://..kusto.windows.net"; var managedIdentityClientId = ""; var kustoConnectionStringBuilder = new KustoConnectionStringBuilder(kustoUri) @@ -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://..kusto.windows.net"; var userAccessToken = ""; var appAccessToken = ""; @@ -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://..kusto.windows.net"; Func tokenProviderCallback; // User-defined method to retrieve the access token var kustoConnectionStringBuilder = new KustoConnectionStringBuilder(kustoUri) @@ -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://..kusto.windows.net"; var appId = ""; X509Certificate2 appCert; @@ -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://..kusto.windows.net"; var appId = ""; var appCert = ""; @@ -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" @@ -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) @@ -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"; @@ -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 = ""; var appKey = ""; @@ -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 = ""; var appAccessToken = ""; @@ -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 tokenProviderCallback; // User-defined method to retrieve the access token var kustoConnectionStringBuilder = new KustoConnectionStringBuilder(kustoUri) @@ -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 = ""; X509Certificate2 appCert; @@ -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 = ""; var appCert = ""; diff --git a/data-explorer/kusto/api/get-started/app-client-network-restrictions.md b/data-explorer/kusto/api/get-started/app-client-network-restrictions.md index 721d8fc083..bf6c975fb4 100644 --- a/data-explorer/kusto/api/get-started/app-client-network-restrictions.md +++ b/data-explorer/kusto/api/get-started/app-client-network-restrictions.md @@ -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} ) ``` @@ -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 ); @@ -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)