Anonymous
Not applicable

@Akash Sharma​ :

The error message you are seeing indicates that the on-behalf-of token creation feature for service principals is not enabled for your Databricks workspace. To enable this feature, you will need to contact Databricks support and request that they enable it for your workspace.

Once the feature is enabled, you should be able to use the /api/2.0/token-management/on-behalf-of/tokens endpoint to generate an access token for the service principal.

In the meantime, you can generate a token manually by using the Databricks UI:

  1. Log in to the Databricks workspace using an account with admin privileges.
  2. Navigate to the "User Settings" page by clicking on your user avatar in the top right corner and selecting "User Settings".
  3. Click on the "Access Tokens" tab.
  4. Click the "Generate New Token" button.
  5. Enter a name for the token and select the appropriate expiration date.
  6. Under "Generate token for:", select "Service Principal".
  7. Select the service principal from the dropdown list.
  8. Click "Generate".

This will generate an access token for the service principal, which you can use in your API requests.