# How to map Native Realm Active Directory users to Google Drive users?

**URL:** <https://discuss.elastic.co/t/how-to-map-native-realm-active-directory-users-to-google-drive-users/270769>\
**Category:** Elastic Search\
**Created:** [April 20, 2021, 9:50pm UTC](https://discuss.elastic.co/t/how-to-map-native-realm-active-directory-users-to-google-drive-users/270769 "2021-04-20T21:50:25Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![jerrac](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jerrac/32/52980_2.png) [@jerrac](https://discuss.elastic.co/u/jerrac)\
**Post date:** [April 20, 2021, 9:50pm UTC](https://discuss.elastic.co/t/how-to-map-native-realm-active-directory-users-to-google-drive-users/270769/1 "2021-04-20T21:50:25Z")

</div>

From the [docs](https://www.elastic.co/guide/en/workplace-search/7.12/workplace-search-external-identities-api.html) I've been trying to map my Active Directory users to their Google Drive counterparts. The API calls return 200, but when I try to list all identities, the list is empty.

```auto
POST http://search.example.org/api/ws/v1/sources/< id >/external_identities
Authorization: Bearer < token >
Content-Type: application/json

{
  "user": "adusername",
  "source_user_id": "adusername@example.org"
}

```

I have Elasticsearch configured to authenticate against AD.

In enterprise-search.yml, I have set `ent_search.auth.es_users.source: elasticsearch-native`.

What am I missing?

This is all on version 7.12.

I can log into Enterprise Search with my AD user, as can other users.

---

<div class="post-metadata">

**Author:** ![JonasLavoie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jonaslavoie/32/56961_2.png) [@JonasLavoie](https://discuss.elastic.co/u/JonasLavoie)\
**Post date:** [April 20, 2021, 9:56pm UTC](https://discuss.elastic.co/t/how-to-map-native-realm-active-directory-users-to-google-drive-users/270769/2 "2021-04-20T21:56:27Z")

</div>

Heya David - to confirm: you are looking to map users on Google Drive for the purposes of result-level permission management, correct?

Have you successfully ingested documents in the Google Drive source making sure Document-Level Permission Synchronization was turned on at connection time?

---

<div class="post-metadata">

**Author:** ![jerrac](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jerrac/32/52980_2.png) [@jerrac](https://discuss.elastic.co/u/jerrac)\
**Post date:** [April 20, 2021, 10:02pm UTC](https://discuss.elastic.co/t/how-to-map-native-realm-active-directory-users-to-google-drive-users/270769/3 "2021-04-20T22:02:22Z")

</div>

Yes, I selected the document level permission option when creating the google drive source.

The google drive source overview says that there are over 5000 documents.

The status says:

![image](https://us1.discourse-cdn.com/elastic/original/3X/5/2/52ae709db519a7a13f631913c9d9bd5d68a81c75.png)

---

<div class="post-metadata">

**Author:** ![JonasLavoie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jonaslavoie/32/56961_2.png) [@JonasLavoie](https://discuss.elastic.co/u/JonasLavoie)\
**Post date:** [April 20, 2021, 10:09pm UTC](https://discuss.elastic.co/t/how-to-map-native-realm-active-directory-users-to-google-drive-users/270769/4 "2021-04-20T22:09:46Z")

</div>

Perfect, thanks for confirming -

> when I try to list all identities, the list is empty

Using the [List API endpoint](https://www.elastic.co/guide/en/workplace-search/current/workplace-search-external-identities-api.html#list-external-identities) should return the appropriate mappings as defined, granted the Content Source ID is the same as the one used for setting up the mappings.

Are you able to retrieve individual mappings [using the Show Endpoint](https://www.elastic.co/guide/en/workplace-search/current/workplace-search-external-identities-api.html#show-external-identity)?

---

<div class="post-metadata">

**Author:** ![jerrac](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jerrac/32/52980_2.png) [@jerrac](https://discuss.elastic.co/u/jerrac)\
**Post date:** [April 20, 2021, 10:21pm UTC](https://discuss.elastic.co/t/how-to-map-native-realm-active-directory-users-to-google-drive-users/270769/5 "2021-04-20T22:21:26Z")

</div>

Here's what I get, when I GET:

```auto
GET https://search.example.org/api/ws/v1/sources/< id >/external_identities

{
  "meta": {
    "page": {
      "current": 1,
      "total_pages": 0,
      "total_results": 0,
      "size": 25
    }
  },
  "results": []
}

```

Using the exact same content source id for the POST and GET requests.

You're question about the "Show Endpoint" would be querying for a specific user, right?

Something like:

```auto
GET https://search.example.org/api/ws/v1/sources/< id >/external_identities/< username >

```

I tried that with both the AD username and the Google username. Both received 404's in response.

Ah, i was also using the google drive ID for it.

---

<div class="post-metadata">

**Author:** ![Sean\_Story](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sean_story/32/69987_2.png) [@Sean\_Story](https://discuss.elastic.co/u/Sean_Story)\
**Post date:** [April 20, 2021, 10:35pm UTC](https://discuss.elastic.co/t/how-to-map-native-realm-active-directory-users-to-google-drive-users/270769/6 "2021-04-20T22:35:47Z")

</div>

> [@jerrac](#):
>
> The API calls return 200,

@jerrac can you send us the full `curl` command you're using (with `-v` for verbose output), and the full response back, when you attempt to add your external identity? With your token obfuscated, of course.

---

<div class="post-metadata">

**Author:** ![jerrac](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jerrac/32/52980_2.png) [@jerrac](https://discuss.elastic.co/u/jerrac)\
**Post date:** [April 20, 2021, 10:51pm UTC](https://discuss.elastic.co/t/how-to-map-native-realm-active-directory-users-to-google-drive-users/270769/7 "2021-04-20T22:51:26Z")

</div>

Er, yeah, helps to use https in the post request. Not http...

Now my user mappings are getting added and that status message has gone away.

Thanks for the help!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 4, 2022, 8:29am UTC](https://discuss.elastic.co/t/how-to-map-native-realm-active-directory-users-to-google-drive-users/270769/8 "2022-11-04T08:29:14Z")

</div>


