|
| 1 | +--- |
| 2 | +title: Manage Client Network Restrictions |
| 3 | +description: Resolve DNS validation errors in Kusto tools by adding custom allowances or disabling validation for specific use cases. |
| 4 | +ms.reviewer: yogilad |
| 5 | +ms.author: spelluru |
| 6 | +author: spelluru |
| 7 | +ms.topic: how-to |
| 8 | +ms.date: 11/16/2025 |
| 9 | +ms.custom: |
| 10 | +--- |
| 11 | + |
| 12 | +# Manage client network restrictions |
| 13 | + |
| 14 | +When you use Kusto tools and SDKs, network security is a top priority. To protect customer data, queries, and authentication tokens, Kusto enforces DNS restrictions that limit connections to a predefined set of trusted domains. While these restrictions improve security, some scenarios might require bypassing them to support custom configurations, like hosting Kusto behind custom URIs or using older SDK versions. These scenarios include: |
| 15 | + |
| 16 | +- Customers hosting Kusto behind custom URIs |
| 17 | +- Customers hosting Kusto behind Azure Front Door for redundancy or high availability |
| 18 | +- Customers using an older version of the SDK where new domains aren't yet allowed |
| 19 | +- Customers using an older version of the SDK in new clouds |
| 20 | + |
| 21 | +In these cases, Kusto SDK and Tools allow adding custom allowances to bypass the default restrictions. |
| 22 | + |
| 23 | +> [!IMPORTANT] |
| 24 | +> |
| 25 | +> For the latter two cases, the best way to resolve the issue is to update to the latest version of the SDK or tool you use. Use custom domains and policy overrides only as a short-term solution. |
| 26 | +
|
| 27 | +This article gives step-by-step guidance on managing DNS restrictions in Kusto tools, including adding trusted hosts, disabling DNS validation, and customizing validation policies programmatically. |
| 28 | + |
| 29 | +## Bypass DNS restrictions with Kusto Explorer |
| 30 | + |
| 31 | +1. Open Kusto Explorer. |
| 32 | +1. From the **Tools** ribbon, select **Options**. |
| 33 | +1. Select **Connections**. |
| 34 | +1. In **Additional Trusted Hosts**, add the fully qualified hostname or DNS suffix (preceded with an asterisk `*`) you want to work with. You can list multiple FQDNs or DNS suffixes by separating them with a semicolon `;`. |
| 35 | + |
| 36 | + :::image type="content" source="../../media/bypass-dns-restrictions/kusto-explorer-options.png" alt-text="Screenshot of the Options editor open with the Additional Trusted Hosts field highlighted."::: |
| 37 | + |
| 38 | +## Bypass DNS restrictions with Azure Data Explorer |
| 39 | + |
| 40 | +1. Open Azure Data Explorer. |
| 41 | +1. Select the *Settings* icon in the top-right corner. |
| 42 | +1. Select **Connection**. |
| 43 | +1. In **Additional trusted hosts**, add the fully qualified hostname or DNS suffix (preceded with an asterisk `*`) you want to work with. List multiple FQDNs or DNS suffixes by separating them with a semicolon `;`. |
| 44 | + |
| 45 | + :::image type="content" source="../../media/bypass-dns-restrictions/kusto-web-explorer-settings.png" alt-text="Screenshot of ADX Settings editor open with the Additional trusted hosts field highlighted."::: |
| 46 | + |
| 47 | +## Bypass DNS restrictions with command-line applications and tools |
| 48 | + |
| 49 | +For command-line applications and tools, disable DNS validation entirely by passing a command-line argument or setting an environment variable. |
| 50 | + |
| 51 | +> [!NOTE] |
| 52 | +> Disabling DNS validation using environment variables affects all applications and tools using the C# SDK, including Kusto Explorer, Light Ingest, Kusto CLI, Perkus, and any third-party application developed with the C# Kusto SDK. |
| 53 | +
|
| 54 | +To disable using a command-line argument, add the following argument to the tool's command line. |
| 55 | + |
| 56 | +```shell |
| 57 | +-tweaks:Kusto.Cloud.Platform.Data.EnableWellKnownKustoEndpointsValidation=false |
| 58 | +``` |
| 59 | + |
| 60 | +To disable using an environment variable: |
| 61 | + |
| 62 | +```shell |
| 63 | +SET TWEAKS="Kusto.Cloud.Platform.Data.EnableWellKnownKustoEndpointsValidation=false" |
| 64 | +``` |
| 65 | + |
| 66 | +## Bypass DNS restrictions with Kusto SDKs |
| 67 | + |
| 68 | +Use Kusto SDKs to programmatically control DNS validation by adding trusted hosts and DNS domains, or by providing the SDK with a predicate that takes the target hostname and returns *true* or *false* depending on whether the connection is allowed. |
| 69 | + |
| 70 | +### [C#](#tab/csharp) |
| 71 | + |
| 72 | +```csharp |
| 73 | + |
| 74 | +using Kusto.Data.Common; |
| 75 | + |
| 76 | +// Add a DNS domain |
| 77 | +KustoTrustedEndpoints.AddTrustedHosts( |
| 78 | + new[] { new FastSuffixMatcher<EndpointContext>.MatchRule("*.domain.com", exact: false, context: KustoTrustedEndpoints.KustoEndpointContext) }, |
| 79 | + replace:false); |
| 80 | + |
| 81 | +// Add a fully qualified domain name |
| 82 | +KustoTrustedEndpoints.AddTrustedHosts( |
| 83 | + new[] { new FastSuffixMatcher<EndpointContext>.MatchRule("mykusto.domain.com", exact: true, context: KustoTrustedEndpoints.KustoEndpointContext) }, |
| 84 | + replace:false); |
| 85 | + |
| 86 | +// Set a custom validation policy |
| 87 | +KustoTrustedEndpoints.SetOverridePolicy( |
| 88 | + (hostname) => true, |
| 89 | + KustoTrustedEndpoints.KustoEndpointContext); |
| 90 | + |
| 91 | +``` |
| 92 | + |
| 93 | +### [Go](#tab/go) |
| 94 | + |
| 95 | +```go |
| 96 | + |
| 97 | +import ( |
| 98 | + "github.com/Azure/azure-kusto-go/azkustodata/trustedEndpoints" |
| 99 | +) |
| 100 | + |
| 101 | +// Add a DNS domain |
| 102 | +trustedEndpoints.Instance.AddTrustedHosts([]trustedEndpoints.MatchRule{ |
| 103 | + security.NewMatchRule("*.domain.com", false), |
| 104 | +}) |
| 105 | + |
| 106 | +// Add a fully qualified domain name |
| 107 | +trustedEndpoints.Instance.AddTrustedHosts([]trustedEndpoints.MatchRule{ |
| 108 | + security.NewMatchRule("mykusto.domain.com", true), |
| 109 | +}) |
| 110 | + |
| 111 | +// Set a custom validation policy |
| 112 | +trustedEndpoints.Instance.SetOverrideMatcher( |
| 113 | + func(h string) bool { |
| 114 | + return true |
| 115 | + }, |
| 116 | + security.KustoTrustedEndpoints.KustoEndpointContext, |
| 117 | +) |
| 118 | + |
| 119 | +``` |
| 120 | + |
| 121 | +### [Java](#tab/java) |
| 122 | + |
| 123 | +```java |
| 124 | + |
| 125 | +import com.microsoft.azure.kusto.data.auth.endpoints.KustoTrustedEndpoints; |
| 126 | +import com.microsoft.azure.kusto.data.auth.endpoints.MatchRule; |
| 127 | + |
| 128 | +// Add a DNS domain |
| 129 | +KustoTrustedEndpoints.addTrustedHosts( |
| 130 | + java.util.Arrays.asList(new MatchRule("*.domain.com", false))); |
| 131 | + |
| 132 | +// Add a fully qualified domain name |
| 133 | +KustoTrustedEndpoints.addTrustedHosts( |
| 134 | + java.util.Arrays.asList(new MatchRule("mykusto.domain.com", true))); |
| 135 | + |
| 136 | +// Set a custom validation policy |
| 137 | +KustoTrustedEndpoints.setOverridePolicy( |
| 138 | + h -> true, |
| 139 | + KustoTrustedEndpoints.KustoEndpointContext); |
| 140 | + |
| 141 | +``` |
| 142 | + |
| 143 | +### [JavaScript](#tab/javascript) |
| 144 | + |
| 145 | +```javascript |
| 146 | + |
| 147 | +import { KustoTrustedEndpoints, MatchRule } from "azure.kusto.data"; |
| 148 | + |
| 149 | +// Add a DNS domain |
| 150 | +KustoTrustedEndpoints.addTrustedHosts([new MatchRule("*.domain.com", false)]); |
| 151 | + |
| 152 | +// Add a fully qualified domain name |
| 153 | +KustoTrustedEndpoints.addTrustedHosts([new MatchRule("mykusto.domain.com", true)]); |
| 154 | + |
| 155 | +// Set a custom validation policy |
| 156 | +KustoTrustedEndpoints.setOverrideMatcher( |
| 157 | + (h) => true, |
| 158 | + KustoTrustedEndpoints.KustoEndpointContext |
| 159 | +); |
| 160 | + |
| 161 | +``` |
| 162 | + |
| 163 | +### [Python](#tab/python) |
| 164 | + |
| 165 | +```python |
| 166 | + |
| 167 | +from azure.kusto.data.security import KustoTrustedEndpoints, MatchRule |
| 168 | + |
| 169 | +# Add a DNS domain |
| 170 | +KustoTrustedEndpoints.add_trusted_hosts([MatchRule("*.domain.com", exact=False)]) |
| 171 | + |
| 172 | +# Add a fully qualified domain name |
| 173 | +KustoTrustedEndpoints.add_trusted_hosts([MatchRule("mykusto.domain.com", exact=True)]) |
| 174 | + |
| 175 | +# Set a custom validation policy |
| 176 | +KustoTrustedEndpoints.set_override_matcher( |
| 177 | + lambda h: True, |
| 178 | + KustoTrustedEndpoints.KustoEndpointContext) |
| 179 | + |
| 180 | +``` |
0 commit comments