Repository navigation
feat(bindings): thread Azure service-principal M2M through the napi + C ABI bindings - #280
Merged
eric-wang-1990 merged 2 commits intoAug 21, 2026
Conversation
…he binding Add AuthMode::AzureSpM2m to the napi binding, mirroring the pyo3 auth_type="azure-sp-m2m" surface added for Python. New ConnectionOptions fields: azureClientId + azureClientSecret (required), plus optional azureTenantId (kernel auto-discovers from the workspace /aad/auth redirect when omitted) and azureWorkspaceResourceId (when set, the kernel also sends the Azure SP management token + X-Databricks-Azure-Workspace-Resource-Id header, so an SP with an Azure RBAC role but no workspace membership can authenticate). The build_auth_config arm forwards to the kernel's AuthConfig::azure_service_principal; the kernel owns Azure resolution. Azure AD U2M needs no new mode — it rides the existing AuthMode::OAuthU2m (the kernel's workspace-federated browser flow, which Azure workspaces support). Regenerated napi/index.d.ts to match. Stacked on the pyo3/core azure-sp-m2m PR (#263), which is where AuthConfig::azure_service_principal lives. Co-authored-by: Isaac Signed-off-by: eric-wang-1990 <e.wang@databricks.com>
eric-wang-1990
temporarily deployed
to
azure-prod
August 21, 2026 07:39 — with
GitHub Actions
Inactive
…or Go/ODBC Add kernel_session_config_set_auth_azure_sp to the C ABI, so Go/ODBC consumers can use Azure Entra service-principal M2M — the C-ABI analog of the pyo3/napi azure-sp-m2m surface. Required azure_client_id + azure_client_secret; optional azure_tenant_id (NULL -> kernel auto-discovers from the workspace /aad/auth redirect) and azure_workspace_resource_id (set -> kernel also sends the Azure SP management token + X-Databricks-Azure-Workspace-Resource-Id header, for an SP with an Azure RBAC role but no workspace membership). New AuthSpec::AzureServicePrincipal variant + conversion to AuthConfig::azure_service_principal (carrying the shared federation client id). Hand-written header declaration added. Azure AD U2M needs no new setter — it rides set_auth_u2m (the kernel's workspace-federated browser flow, which Azure Databricks workspaces support). Co-authored-by: Isaac Signed-off-by: eric-wang-1990 <e.wang@databricks.com>
eric-wang-1990
temporarily deployed
to
azure-prod
August 21, 2026 07:48 — with
GitHub Actions
Inactive
eric-wang-1990
temporarily deployed
to
azure-prod
August 21, 2026 07:48 — with
GitHub Actions
Inactive
vuanhphung
approved these changes
Aug 21, 2026
eric-wang-1990
merged commit Aug 21, 2026
53fc45e
into
eric-wang/azure-service-principal-design
8 checks passed
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Threads Azure Entra service-principal M2M through the napi (Node.js) and C ABI (Go / ODBC) bindings — the analogs of the pyo3
auth_type="azure-sp-m2m"surface that #263 added for Python. #263 wired azure-sp-m2m through pyo3 + the coreAuthConfig, but left the other two bindings untouched.How
napi (
napi/src/database.rs,napi/index.d.ts):AuthMode::AzureSpM2m+ConnectionOptionsfieldsazureClientId/azureClientSecret(required),azureTenantId?,azureWorkspaceResourceId?.build_auth_configarm →AuthConfig::azure_service_principal(...).index.d.tsregenerated to match.C ABI (
src/c_abi/session.rs,include/databricks_kernel.h):kernel_session_config_set_auth_azure_sp(config, azure_client_id, azure_client_secret, azure_tenant_id, azure_workspace_resource_id)alongsideset_auth_pat/_m2m/_m2m_jwt/_u2m.AuthSpec::AzureServicePrincipalvariant + conversion toAuthConfig::azure_service_principal(carrying the shared federation client id). Hand-written header declaration added.Common semantics across both:
azureClientId+azureClientSecretrequired;azureTenantIdoptional (kernel auto-discovers from the workspace/aad/authredirect when omitted);azureWorkspaceResourceIdoptional (set ⇒ the kernel also sends the Azure SP management token +X-Databricks-Azure-Workspace-Resource-Idheader, for an SP with an Azure RBAC role but no workspace membership; omitted ⇒ the data token authenticates alone). The bindings stay thin — the kernel owns all Azure resolution (Entra token endpoint,{app}/.defaultscope, tenant discovery, and the management token's v1.0resource=grant).Azure AD U2M needs no new mode/setter on either binding — it rides the existing napi
AuthMode::OAuthU2m/ C-ABIset_auth_u2m, i.e. the kernel's in-house workspace-federated browser flow, which Azure Databricks workspaces support. The connectors map their Azure-U2M selectors onto that (separate connector-repo PRs).Tests
cargo test --features dyn-symbols):azure_sp_m2m_builds_azure_service_principal,azure_sp_m2m_tenant_and_resource_id_optional,azure_sp_m2m_requires_client_id_and_secret.cargo test):azure_sp_builds_azure_service_principal(incl. federation id passthrough),azure_sp_tenant_and_resource_id_optional.clippy -D warningsclean; napi loader drift check passes; TDD throughout (stub → RED → real arm → GREEN on both bindings).Related
KernelAuth.ts+ Python already merged/in-flight): separate connector-repo PRs.This pull request and its description were written by Isaac.