From a23be749219ad062c3025a354bdbdebe80d4a1e3 Mon Sep 17 00:00:00 2001 From: Yochai Gilad Date: Mon, 24 Nov 2025 17:26:05 +0200 Subject: [PATCH 1/2] fix code samples Following some tests --- .../app-client-network-restrictions.md | 37 ++++++------------- 1 file changed, 12 insertions(+), 25 deletions(-) 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) From fcecd8026f8e2b65290a80e9097890e555042c54 Mon Sep 17 00:00:00 2001 From: ktalmor <193799742+ktalmor@users.noreply.github.com> Date: Tue, 25 Nov 2025 12:41:10 +0200 Subject: [PATCH 2/2] KUS: UUF Kusto connections examples # Thank you for contributing to Kusto documentation Please add a brief comment outlining the purpose of this PR. Add links to any relevant references such as DevOps work items. ## Make sure you've done the following: 1. **Acrolinx**: Make sure your Acrolinx score is **at least 80** (higher is better) and with **0** spelling issues. 1. **Successful build**: Review the build status to make sure **all files are green** (Succeeded) and there are no errors, warnings, or suggestions. 1. **Preview the pages**: Click each **Preview URL** link, scan the entire page looking for formatting issues, in particular the parts you edited. 1. **Check the Table of Contents**: If you're adding a new markdown file, make sure it is linked from the table of contents. 1. **Sign off**: Once the PR is finalized, add a comment with `#sign-off` . If you need to cancel the sign-off, add a comment with `#hold-off`. **NOTE**: *Signing off means the document can be published at any time.* ## Next steps - All PRs to this repository are reviewed and merged by a human. Automatic merge is disabled on this repository for PRs, even with the qualifies-for-auto-merge label. - Once all feedback on the PR is addressed, the PR will be merged into the main branch. [Learn more about how to contribute](https://review.learn.microsoft.com/en-us/help/platform/?branch=main) --- .../kusto/api/connection-strings/kusto.md | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) 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 = "";