The Simplest Way to Make Databricks ML and Keycloak Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

You link databricks ml and keycloak to manage who runs models and reads data. Keycloak handles user logins and group roles, while Databricks runs training jobs and notebooks. Data teams need one place to manage user accounts and group rules. Without a central login tool, admins must add users by hand in every workspace. Linking these two systems lets you grant workspace rights from your main directory. When a user leaves the team, you block their account in one spot. How logins and data flow

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You link databricks ml and keycloak to manage who runs models and reads data. Keycloak handles user logins and group roles, while Databricks runs training jobs and notebooks.

Data teams need one place to manage user accounts and group rules. Without a central login tool, admins must add users by hand in every workspace. Linking these two systems lets you grant workspace rights from your main directory. When a user leaves the team, you block their account in one spot.

How logins and data flow between databricks ml and keycloak

The login flow starts when a data scientist opens the workspace in a browser. The workspace sends the user over to your Keycloak server to log in. Keycloak checks the user password and asks for a second login factor. Next, it builds a signed token that lists the user email and group names.

The browser sends this signed token back to the workspace to start a session. You can also sync users and groups ahead of time using standard provisioning tools. Once inside, the user opens a notebook or starts a model training run. The workspace checks the user group to decide which tables they can read.

Machine learning jobs also need a safe way to run on a schedule. Automated jobs should not use a personal user account to read training data. Instead, you set up a dedicated service identity for each automated pipeline. This setup keeps human actions separate from scheduled model runs in your logs.

Common failure modes and how to scope roles

Many teams make the mistake of sharing one admin account across several notebooks. When three people use one account, the audit log shows the same name. You cannot tell who deleted a model or exported a table of customer emails. Shared long-lived tokens create another big risk for data teams.

Developers often copy personal tokens into local scripts to test model endpoints. If a laptop gets lost, an attacker can use that token to read data. Broad group roles also cause trouble when every scientist gets full workspace rights. A user who only needs to test a model might alter production tables.

Keycloak + End-to-End Encryption: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

You can fix these issues by mapping small, specific groups in Keycloak. Create separate groups for data readers, model builders, and workspace admins. Map each group to strict table rules inside your data catalog. Turn off personal tokens for regular users and require short browser sessions instead.

Keeping sensitive fields safe during model training

Role mapping controls who enters the workspace, but notebooks still pull raw rows. Training tables often hold private fields like phone numbers, card numbers, or national IDs. If a query returns full records, those values sit in notebook memory and logs. Teams should add controls that rewrite matched fields in results before notebooks read them.

Network rules also help lock down how data moves between your systems. Put your identity server and workspace behind strict firewall rules on private networks. Check your login logs every week to spot failed sign-ins or odd query spikes. Good role limits and clean logs keep your machine learning work safe.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.

Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.

Frequently asked questions

Can I sync Keycloak groups to Databricks workspaces automatically?

Yes, you can use standard identity bridges or custom scripts to push group changes. This keeps your workspace roles matched with your main directory without manual edits.

How do we stop data scientists from sharing personal access tokens?

You can turn off personal token creation for standard user groups in workspace settings. Force all human users to log in through the identity provider with short sessions.

What happens to running ML jobs when a user leaves the team?

Jobs tied to a personal account will fail once you block that user in Keycloak. Always run scheduled training jobs under a dedicated service identity so pipelines stay up.

The query runs. The emails stay hidden.