andres_garcia
Databricks Employee
Databricks Employee

Hi @Asaph, this could be an authentication or missing configuration issue. Please ensure that the AccountClient class instance is created with the required authentication details. Additionally, since this is an account-level operation, check you have account admin privileges to run it successfully.

Example code:

 

from databricks.sdk import WorkspaceClient, AccountClient
import time

account_client = AccountClient(
    host='', # databricks account console host
    account_id='', # databricks account id
    # authentication options 
    # client_id/client_secret best practice
    client_id='',
    client_secret=''
)

sp_create = account_client.service_principals.create(active=True, display_name=f'sdk-{time.time_ns()}')

sp = account_client.service_principals.get(id=sp_create.id)

# cleanup
account_client.service_principals.delete(id=sp_create.id)

 

Mark as resolved if this solves your issue.