问题描述
我一直在关注文档:https://docs.microsoft.com/en-us/azure/databricks/dev-tools/api/latest/aad/service-prin-aad-token
创建服务主体并使用它来访问Databricks。我已经配置了databricks工作区,并使用它来创建集群。然后,我按照文档中提到的过程创建了服务主体,并获得了两个令牌:AD Access令牌和管理访问令牌。但是,我无法使用该API。
配置后的最终调用cURL命令:
curl -X GET \
-H 'Authorization: Bearer <access-token>' \
-H 'X-Databricks-Azure-SP-Management-Token: <management-access-token>' \
-H 'X-Databricks-Azure-Workspace-Resource-Id: /subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Databricks/workspaces/<workspace-name>' \
https://<databricks-instance>/api/2.0/clusters/list
使用令牌和其他信息替代后,将提供以下结果:
<html>
<head>
<Meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 403 User not authorized.</title>
</head>
<body><h2>HTTP ERROR 403</h2>
<p>Problem accessing /api/2.0/clusters/list. Reason:
<pre> User not authorized.</pre></p>
</body>
</html>
我已经尝试了一些方法来解决此问题,即使用authorization_code
授予类型将原始访问令牌请求更改为使用交互式流,依此类推,但这仅给了我Invalid access token
错误。
上述配置是否有问题?我缺少一些权限吗?
更新:来到访问控制(IAM)页面,该应用似乎未包含在其中。