Find your workspace ID

Learn how to find your Databricks workspace ID in the web UI as well as via a notebook command.

Written by sivaprasad.cs

Last published at: September 16th, 2024

Everything you do in Databricks occurs within a workspace. When you use the web UI you are interacting with clusters and notebooks in the workspace. When you run automated jobs or connect to your workspace outside of the web UI you may need to know your workspace ID.

This article covers two different ways to easily find your workspace ID.

Instructions

From the browser

When viewing a Databricks workspace, the workspace ID is contained within the web URL.

After you have logged into your Databricks workspace, look at the URL displayed in your browser's address bar.

You should see a series of numbers displayed in the URL after o=. The numbers following the o= make up the workspace ID.

Given https://<databricks-instance>.com/o=XXXXX, the workspace ID is the numeric value represented by XXXXX.

In this example URL, the workspace ID is 2281745829657864

https://abcd-teste2-test-spcse2.cloud.databricks.com/?o=2281745829657864#


From a notebook

You can get the workspace ID from within a notebook by running

from dbruntime.databricks_repl_context import get_context

get_context().workspaceId

 in a Python or Scala cell.

It returns the workspace ID when run.