Hi @Chinu, Certainly! Let’s address your questions regarding workspace IDs and names in Azure Databricks.
Workspace IDs and Names:
- Each Azure Databricks workspace has a unique numerical workspace ID. Additionally, there is a per-workspace URL assigned to every deployment. This URL follows the format adb-<workspace-id>.<random-number>.azuredatabricks.net, where the workspace ID appears immediately after adb- and before the dot (.).
- For example, if you have a per-workspace URL like 1, the instance name is adb-5555555555555555.19.azuredatabricks.net, and the workspace ID is 5555555555555555.
- It’s essential to avoid using legacy regional URLs, as they may not work for new workspaces and exhibit lower performance. Instead, rely on per-workspace URLs for consistency and reliability.
Mapping Workspace IDs to Names:
- Unfortunately, the “usage” table in the billing schema does not directly provide workspace names.
- However, you can create a mapping between workspace IDs and names by leveraging the following approaches:
- Within a Notebook:
- Run the following code in a Python or Scala cell within a notebook:spark.conf.get("spark.databricks.clusterUsageTags.clusterOwnerOrgId")
- This will return the workspace ID.
- URL Inspection:
- After logging into your Databricks workspace, examine the URL displayed in your browser’s address bar.
- Look for a series of numbers displayed after o=; this is the workspace ID.
- Azure API:
- Use the Azure API to obtain the per-workspace URL and extract the workspace ID from it.
Creating a Table with Workspace ID and Name:
- Since you don’t have access to the Databricks account level, consider creating a custom table that maps workspace IDs to names within your workspace.
- You can maintain this table by manually associating workspace IDs with their corresponding names.
- Alternatively, if you have a consistent naming convention for workspaces, you could programmatically generate workspace names based on the workspace IDs.
Remember that workspace IDs are stable and unique, making them reliable for mapping purposes. If you encounter any further challenges, feel free to ask for additional assistance! 😊