Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2025 07:44 AM - edited 01-15-2025 07:45 AM
# Using Databricks CLI profile to access the workspace.
w = WorkspaceClient(profile="<<profilename>>")
OR
w = WorkspaceClient(
host=databricks_host,
client_id=app_id,
client_secret=app_secret,
auth_type="azure-cli",
)
OR
from azure.identity import ClientSecretCredential
credential = ClientSecretCredential(
tenant_id="<tenant-id>",
client_id="<client-id>",
client_secret="<client-secret>"
)
# Get the access token for Databricks
# Initialize the WorkspaceClient using the service principal token
client = WorkspaceClient(
host="https://<databricks-instance>",
token=token
)
OR
# Initialize the WorkspaceClient using an OAuth token
w = WorkspaceClient(
host="https://<databricks-instance>",
token="<oauth-token>"
)
OR
w = WorkspaceClient(
host=databricks_host,
token=pat_token,
)