You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 53fc45e
Browse filesBrowse the repository at this point in the historyBrowse files
feat(bindings): thread Azure service-principal M2M through the napi + C ABI bindings (#280)
## 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 core `AuthConfig`, but left the
other two bindings untouched.
> **Stacked on #263** — targets
`eric-wang/azure-service-principal-design` because it calls
`AuthConfig::azure_service_principal`, which lives in #263, not `main`.
Rebase onto `main` once #263 merges.
## How
**napi** (`napi/src/database.rs`, `napi/index.d.ts`):
- New `AuthMode::AzureSpM2m` + `ConnectionOptions` fields
`azureClientId` / `azureClientSecret` (required), `azureTenantId?`,
`azureWorkspaceResourceId?`.
- `build_auth_config` arm → `AuthConfig::azure_service_principal(...)`.
`index.d.ts` regenerated to match.
**C ABI** (`src/c_abi/session.rs`, `include/databricks_kernel.h`):
- New `kernel_session_config_set_auth_azure_sp(config, azure_client_id,
azure_client_secret, azure_tenant_id, azure_workspace_resource_id)`
alongside `set_auth_pat` / `_m2m` / `_m2m_jwt` / `_u2m`.
- New `AuthSpec::AzureServicePrincipal` variant + conversion to
`AuthConfig::azure_service_principal` (carrying the shared federation
client id). Hand-written header declaration added.
Common semantics across both: `azureClientId` + `azureClientSecret`
required; `azureTenantId` optional (kernel auto-discovers from the
workspace `/aad/auth` redirect when omitted); `azureWorkspaceResourceId`
optional (set ⇒ the 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; omitted ⇒ the data token
authenticates alone). The bindings stay thin — the kernel owns all Azure
resolution (Entra token endpoint, `{app}/.default` scope, tenant
discovery, and the management token's v1.0 `resource=` grant).
**Azure AD U2M needs no new mode/setter** on either binding — it rides
the existing napi `AuthMode::OAuthU2m` / C-ABI `set_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
- **napi** (`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`.
- **C ABI** (`cargo test`): `azure_sp_builds_azure_service_principal`
(incl. federation id passthrough),
`azure_sp_tenant_and_resource_id_optional`.
- All green; `clippy -D warnings` clean; napi loader drift check passes;
TDD throughout (stub → RED → real arm → GREEN on both bindings).
## Related
- Kernel core + pyo3: #263.
- Connector bridges (Node `KernelAuth.ts` + Python already
merged/in-flight): separate connector-repo PRs.
- JIRA: PECOBLR-4141 (azure-sp-m2m), PECOBLR-4120 (Azure U2M).
This pull request and its description were written by Isaac.
---------
Signed-off-by: eric-wang-1990 <e.wang@databricks.com>
0 commit comments