# Assign a role to multiple users

**URL:** <https://discuss.elastic.co/t/assign-a-role-to-multiple-users/328462>\
**Category:** Kibana\
**Created:** [March 24, 2023, 1:13pm UTC](https://discuss.elastic.co/t/assign-a-role-to-multiple-users/328462 "2023-03-24T13:13:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![artax\_sb](https://avatars.discourse-cdn.com/v4/letter/a/c68b51/32.png) [@artax\_sb](https://discuss.elastic.co/u/artax_sb)\
**Post date:** [March 24, 2023, 1:13pm UTC](https://discuss.elastic.co/t/assign-a-role-to-multiple-users/328462/1 "2023-03-24T13:13:50Z")

</div>

I want to assign a new role to my users, but i have 150 users.... there is a way to assign the role to all users at the same time

thanks in advance

---

<div class="post-metadata">

**Author:** ![bhavyarm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bhavyarm/32/22392_2.png) [@bhavyarm](https://discuss.elastic.co/u/bhavyarm)\
**Post date:** [March 24, 2023, 8:22pm UTC](https://discuss.elastic.co/t/assign-a-role-to-multiple-users/328462/2 "2023-03-24T20:22:21Z")

</div>

@Larry_Gregory can we do this?

Thanks,  
Bhavya

---

<div class="post-metadata">

**Author:** ![Larry\_Gregory](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/larry_gregory/32/34969_2.png) [@Larry\_Gregory](https://discuss.elastic.co/u/Larry_Gregory)\
**Post date:** [March 27, 2023, 1:59pm UTC](https://discuss.elastic.co/t/assign-a-role-to-multiple-users/328462/3 "2023-03-27T13:59:29Z")

</div>

Hey @artax_sb,

Based on your question, I assume that your users are in the [`native` realm](https://www.elastic.co/guide/en/elasticsearch/reference/current/native-realm.html)? If so, then there isn't a way to bulk-assign a role to your users, but you can automate this by writing a script which calls the [Elasticsearch's User APIs](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-put-user.html) for each of your users

If you're using a different realm type (e.g. SAML, Kerberos, PKI, OIDC), then you can define a [role mapping](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-roles.html) to assign your users the same role using a single declaration.

---

<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:** [April 24, 2023, 2:00pm UTC](https://discuss.elastic.co/t/assign-a-role-to-multiple-users/328462/4 "2023-04-24T14:00:20Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
