@@ -714,8 +714,8 @@ export function buildKernelConnectionOptions(options: ConnectionOptions): Kernel
714714 ) ;
715715 }
716716
717- // Azure Entra-direct **M2M** → the kernel's dedicated azure-sp-m2m. Mirroring
718- // the Thrift driver's `OAuthManager.getManager`, an Azure host with
717+ // Azure Entra-direct **M2M** → the kernel's dedicated azure-sp-m2m. Closely
718+ // mirroring the Thrift driver's `OAuthManager.getManager`, an Azure host with
719719 // `useDatabricksOAuthInAzure` NOT set to true (the Entra-direct default) plus a
720720 // secret is an Entra service-principal client-credentials flow: the Entra SP
721721 // credentials ride the generic `oauthClientId` / `oauthClientSecret` (Thrift
@@ -733,6 +733,13 @@ export function buildKernelConnectionOptions(options: ConnectionOptions): Kernel
733733 // (`databricks-sql-connector`) + `sql offline_access` scopes, exactly like
734734 // AWS/GCP. Handing the kernel the Thrift Azure Entra-direct app / scope instead
735735 // would derail its in-house flow to a broken AAD authorize URL.
736+ //
737+ // One deliberate divergence from Thrift: `isAzureHost` uses the full suffix
738+ // superset (incl. `.databricks.azure.us`) for every branch, whereas Thrift's
739+ // `useDatabricksOAuthInAzure`-true arm omits `.databricks.azure.us` and so
740+ // throws `OAuth is not supported` for a US-gov host in that mode. Here such a
741+ // host falls through to the in-house flow (accepted) instead — intentional,
742+ // since the kernel's in-house flow is cloud-blind and reachable everywhere.
736743 // The `oauthClientSecret !== undefined` check is inline so TypeScript narrows
737744 // the field to `string` inside the branch (for the AzureSpM2m literal below).
738745 if (
0 commit comments