Why this matters: Databricks compute (DBUs, cluster time, SQL warehouse usage) is billed on its own schedule, separate from the underlying cloud provider invoice, and can scale quickly with query volume or always-on clusters. Without connecting it here, that spend either lives in a separate Databricks-only view nobody checks regularly, or shows up as a surprise on the invoice. Connecting it means Databricks costs show up in Mavvrik's SaaS dashboards, with the same allocation and reporting tools available for your cloud spend.
This shows up differently depending on your role:
-
FinOps managers use this to catch Databricks cost growth (idle clusters, oversized warehouses) before it's a large invoice surprise.
-
Data/platform teams do the actual onboarding: creating the service principal, granting it read-only access, and connecting the SQL warehouse.
-
Finance leaders use this for chargeback when workspaces are shared across multiple teams.
Configuration steps
Step 1: Log in to Databricks and capture the account ID
-
Log in to Databricks as an admin (https://accounts.azuredatabricks.net)
-
Click on the profile icon at top right corner and copy the account ID
Step 2: Create Service Principal
-
Navigate to workspaces from the left menu bar and click Open for the workspace that you want to onboard
-
Click on the workspace and click on open workspace
-
Click on the profile icon at top right corner and click settings
-
Click on Identity and access, then click Manage for Service principals
-
Click on Add service principal and click Add new
-
Select "Databricks managed" and enter the service principal name and click on Add service principal
-
Navigate to the newly created service principal and click the Secrets tab
-
Click the Generate secret button, and then enter the secret's validity in days and click Generate
-
After creating, you will get the client ID and client secret as shown below, and you need to copy and save them
-
After creating, copy and save the Application ID. You will need the Application ID in Step 3 to replace
{service_principal_id}in the SQL script.
Step 3: Run the SQL queries
-
Click on SQL editor and, as a metastore admin, run the following queries in the SQL editor and replace the service principal ID with the Application ID you saved in Step 2
GRANT USE CATALOG ON CATALOG system TO `{service_principal_id}`;
GRANT USE SCHEMA, SELECT ON SCHEMA system.billing TO `{service_principal_id}`;
GRANT USE SCHEMA, SELECT ON SCHEMA system.access TO `{service_principal_id}`;
GRANT USE SCHEMA, SELECT ON SCHEMA system.compute TO `{service_principal_id}`;
GRANT USE SCHEMA, SELECT ON SCHEMA system.query TO `{service_principal_id}`;
GRANT USE SCHEMA, SELECT ON SCHEMA system.lakeflow TO `{service_principal_id}`;
GRANT USE SCHEMA, SELECT ON SCHEMA system.serving TO `{service_principal_id}`;
GRANT USE SCHEMA, SELECT ON SCHEMA system.ai_gateway TO `{service_principal_id}`;
GRANT USE SCHEMA, SELECT ON SCHEMA system.storage TO `{service_principal_id}`;
If a statement fails because the schema is not found, an account admin enables it with databricks system-schemas enable <metastore-id> <schema> (get the id from databricks metastores current), then run the script again.
Replace {service_principal_id} with the Application ID.
Why Mavvrik needs each grant
The system, system.billing and system.access grants are required; Mavvrik needs them to import your costs. The other six are optional. Each feeds savings recommendations, and if one is missing Mavvrik skips only those recommendations while your cost import still runs. All access is read-only. Mavvrik never reads query text, job or task parameters, or request payloads.
-
system(catalog), required: lets the service principal open the system catalog. On its own it gives access to no data; the schema grants below decide what Mavvrik can read. -
system.billing, required: imports your Databricks costs, and ties each cost to the cluster, warehouse, job, pipeline or endpoint that used it. Each day's usage is priced at the list price in force that day. -
system.access, required: shows workspace names on your costs and recommendations. Mavvrik uses daily activity counts to find dashboards, apps and workspaces nobody uses any more. Table lineage finds jobs that write data nobody reads. Cluster change events show Spark settings hard-coded into clusters. -
system.compute, optional: cluster, node, SQL warehouse and instance-pool settings and usage. Mavvrik uses them to find clusters that are idle or oversized, clusters with no or long auto-termination, warehouses that stay up with no work, and pools that keep idle instances running. -
system.query, optional: statement counts, durations and sources per SQL warehouse, never query text. Mavvrik uses them to right-size warehouses and their auto-stop, and to find dashboards, alerts and BI tools that refresh more often than needed. -
system.lakeflow, optional: job and pipeline settings and run history. Mavvrik uses them to find jobs on more expensive all-purpose compute, schedules that run more often than needed, runs that keep failing, and streaming pipelines that never stop. -
system.serving, optional: traffic and settings of model serving endpoints. Mavvrik uses them to find endpoints with little or no traffic that should scale to zero or be smaller, and provisioned throughput that goes unused. -
system.ai_gateway, optional: requests and tokens per AI endpoint and model. Mavvrik uses them to find calls that could use a smaller model or prompt caching. -
system.storage, optional: history of Databricks' automatic table optimisation (predictive optimisation). Mavvrik uses it to find optimisation runs that keep failing, and tables that are optimised often but rarely read.
Step 4: Copy the JDBC URL
-
Click on the existing SQL warehouse that you want to connect
-
Go to the connection details and copy the JDBC URL
Step 5: Integrate into Mavvrik portal
-
Go to the Mavvrik portal and click Admin, then Accounts, then SaaS
-
Click + Account and then select Databricks
-
Enter the details captured above and click Connect
-
Account ID
-
Client ID
-
Client Secret
-
JDBC URL
-
Troubleshooting
-
If the account does not connect, verify the account ID, client ID, client secret, and JDBC URL entered in Mavvrik.
-
If a permission error appears, confirm that the service principal and SQL permissions were configured as described above.
FAQs
What access does the service principal get in Databricks?
Read-only SELECT on eight system schemas (billing, access, compute, query, lakeflow, serving, ai_gateway, storage); no write access to anything.
What is the JDBC URL used for?
It points Mavvrik at the specific SQL warehouse used to query the system tables granted in Step 3.
Why do AI workloads increase Databricks costs?
AI workloads increase Databricks costs because they use compute for more than analytics. Embedding jobs, model serving, Vector Search, fine-tuning, batch inference, and storage all consume resources. Costs rise further when production workloads keep using compute patterns that were originally meant for experimentation.