如何在数据块中使用 azure SCIM api 通过电子邮件 ID 删除用户?

How to delete user by email id using azure SCIM api in databricks?

我想知道是否有办法仅使用 SCIM api 使用电子邮件从数据块中删除用户?现在我看到它只能通过ID删除用户,这意味着我需要先检索用户的ID,然后再使用它来删除。

我正在使用 powershell 中的 api 通过电子邮件删除用户。

https://docs.microsoft.com/en-us/azure/databricks/dev-tools/api/latest/scim/scim-users

如果查看 SCIM Users REST API 的 Get Users command 文档,您会发现可以为其指定过滤条件。例如,要查找特定用户,您可以按 userName 属性进行过滤,如下所示:

GET /api/2.0/preview/scim/v2/Users?filter=userName+eq+example@databricks.com  HTTP/1.1
Host: <databricks-instance>
Accept: application/scim+json
Authorization: Bearer dapi48…a6138b

它将 return Resources 部分中的项目列表,您可以从中提取可用于删除操作的用户 ID:

{
  "totalResults": 1,
  "startIndex": 1,
  "itemsPerPage": 1,
  "schemas": [
    "urn:ietf:params:scim:api:messages:2.0:ListResponse"
  ],
  "Resources": [
    {
      "id": "8679504224234906",
      "userName": "example@databricks.com",
      "emails": [
        {
          "type": "work",
          "value": "example@databricks.com",
          "primary": true
        }
      ],
      "entitlements": [
        {
          "value": "allow-cluster-create"
        },
        {
          "value": "databricks-sql-access"
        },
        {
          "value": "workspace-access"
        }
      ],
      "displayName": "User 1",
      "name": {
        "familyName": "User",
        "givenName": "1"
      },
      "externalId": "12413",
      "active": true,
      "groups": [
        {
          "display": "123",
          "type": "direct",
          "value": "13223",
          "$ref": "Groups/13223"
        }
      ]
    }
  ]
}