Get identifiers for workspace objects

This article explains how to get workspace, cluster, directory, model, notebook, and job identifiers and URLs in Azure Databricks.

Workspace instance names, URLs, and IDs

A unique instance name, also known as a per-workspace URL, is assigned to each Azure Databricks deployment. It is the fully-qualified domain name used to log into your Azure Databricks deployment and make API requests.

An Azure Databricks workspace is where the Azure Databricks platform runs and where you can create Spark clusters and schedule workloads. A workspace has a unique numerical workspace ID.

Per-workspace URL

The unique per-workspace URL has the format adb-<workspace-id>.<random-number>.databricks.azure.cn. The workspace ID appears immediately after adb- and before the "dot" (.). For the per-workspace URL https://adb-5555555555555555.19.databricks.azure.cn/:

  • The instance name is adb-5555555555555555.19.databricks.azure.cn.
  • The workspace ID is 5555555555555555.

Determine per-workspace URL

You can determine the per-workspace URL for your workspace:

Legacy regional URL

Important

Avoid using legacy regional URLs. They may not work for new workspaces, are less reliable, and exhibit lower performance than per-workspace URLs.

The legacy regional URL is composed of the region where the Azure Databricks workspace is deployed plus the domain databricks.azure.cn, for example, https://chinaeast2.databricks.azure.cn/.

  • If you log in to a legacy regional URL like https://chinaeast2.databricks.azure.cn/, the instance name is chinaeast2.databricks.azure.cn.
  • The workspace ID appears in the URL only after you have logged in using a legacy regional URL. It appears after the o=. In the URL https://<databricks-instance>/?o=6280049833385130, the workspace ID is 6280049833385130.

Cluster URL and ID

An Azure Databricks cluster provides a unified platform for various use cases such as running production ETL pipelines, streaming analytics, ad-hoc analytics, and machine learning. Each cluster has a unique ID called the cluster ID. This applies to both all-purpose and job clusters. To get the details of a cluster using the REST API, the cluster ID is essential.

To get the cluster ID, click the Clusters tab in sidebar and then select a cluster name. The cluster ID is the number after the /clusters/ component in the URL of this page

https://<databricks-instance>/#/setting/clusters/<cluster-id>

In the following screenshot, the cluster ID is 0831-211914-clean632.

Cluster URL

Notebook URL and ID

A notebook is a web-based interface to a document that contains runnable code, visualizations, and narrative text. Notebooks are one interface for interacting with Azure Databricks. Each notebook has a unique ID. The notebook URL has the notebook ID, hence the notebook URL is unique to a notebook. It can be shared with anyone on Azure Databricks platform with permission to view and edit the notebook. In addition, each notebook command (cell) has a different URL.

To find a notebook URL or ID, open a notebook. To find a cell URL, click the contents of the command.

  • Example notebook URL:

    https://adb-62800498333851.30.databricks.azure.cn/?o=6280049833385130#notebook/1940481404050342`
    
  • Example notebook ID: 1940481404050342.

  • Example command (cell) URL:

    https://adb-62800498333851.30.databricks.azure.cn/?o=6280049833385130#notebook/1940481404050342/command/2432220274659491
    

Folder ID

A folder is a directory used to store files that can used in the Azure Databricks workspace. These files can be notebooks, libraries or subfolders. There is a specific id associated with each folder and each individual sub-folder. The Permissions API refers to this id as a directory_id and is used in setting and updating permissions for a folder.

To retrieve the directory_id , use the Workspace API:

curl -n -X GET -H 'Content-Type: application/json' -d '{"path": "/Users/me@example.com/MyFolder"}' \
https://<databricks-instance>/api/2.0/workspace/get-status

This is an example of the API call response:

{
  "object_type": "DIRECTORY",
  "path": "/Users/me@example.com/MyFolder",
  "object_id": 123456789012345
}

Model ID

A model refers to an MLflow registered model, which lets you manage MLflow Models in production through stage transitions and versioning. The registered model ID is required for changing the permissions on the model programmatically through the Permissions API.

To get the ID of a registered model, you can use the Workspace API endpoint mlflow/databricks/registered-models/get. For example, the following code returns the registered model object with its properties, including its ID:

curl -n -X GET -H 'Content-Type: application/json' -d '{"name": "model_name"}' \
https://<databricks-instance>/api/2.0/mlflow/databricks/registered-models/get

The returned value has the format:

{
  "registered_model_databricks": {
    "name":"model_name",
    "id":"ceb0477eba94418e973f170e626f4471"
  }
}

Job URL and ID

A job is a way of running a notebook or JAR either immediately or on a scheduled basis.

To get a job URL, click Workflows Icon Workflows in the sidebar and click a job name. The job ID is after the text #job/ in the URL. The job URL is required to troubleshoot the root cause of failed job runs.

In the following screenshot, the job URL is:

https://chinaeast2.databricks.azure.cn/?o=6280049833385130#job/1

In this example, the job ID is 1.

Job URL