Problem
You are trying to use databricks.sdk.AccountClient
in a notebook, with default authentication in your workspace, when you get a NotFound: Endpoint not found
error message.
Example
Using the Databricks SDK account client to list all of your account workspaces generates the following error:
NotFound: Endpoint not found for /2.0/accounts/<your-account-id>/workspaces
Cause
Notebook native authentication is chosen by default when using the SDK inside a Databricks notebook, unless you have specified a different way to authenticate in the account client.
Notebook native authentication is not supported at the account level. It only authenticates at the workspace level.
Solution
You must provide a valid way to authenticate at the account level before you can use databricks.sdk.AccountClient
in a notebook.
You can use OAuth with a service principal as detailed in the Authorize unattended access to Databricks resources with a service principal using OAuth (AWS | Azure | GCP) documentation.
Once you have the service principal client id and the secret, you can authenticate the SDK at the account level by calling AccountClient
in a notebook.
You need to replace the following values:
-
<databricks-account-url>
- Your account URL depends on your cloud.- AWS:
https://accounts.cloud.databricks.com
- Azure:
https://accounts.azuredatabricks.net
- GCP:
https://accounts.gcp.databricks.com
- AWS:
-
<your-account-id>
- You can find your account ID (AWS | Azure | GCP) in the account console. -
<client-id>
and<sp-secret>
- your service principal ID and secret from when you created the service principal.
a = AccountClient(
host="<databricks-account-url>",
account_id='<your-account-id>,
client_id='<client-id>',
client_secret='<sp-secret>'
)
For more information, review the Databricks SDK for Python authentication documentation.