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

Viewed 281
1 Answers

If you look into the documentation for Get Users command of SCIM Users REST API, you can see that you can specify the filtering condition for it. For example, to find specific user, you can filter on the userName attribute, like this:

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

it will return a list of items in the Resources section, from which you can extract user ID that you can use for delete operation:

{
  "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"
        }
      ]
    }
  ]
}
Related