# What roles are needed for a user to create, write, & delete watchers?

**URL:** <https://discuss.elastic.co/t/what-roles-are-needed-for-a-user-to-create-write-delete-watchers/206440>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [November 4, 2019, 4:37pm UTC](https://discuss.elastic.co/t/what-roles-are-needed-for-a-user-to-create-write-delete-watchers/206440 "2019-11-04T16:37:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt\_McGovern](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matt_mcgovern/32/90131_2.png) [@Matt\_McGovern](https://discuss.elastic.co/u/Matt_McGovern)\
**Post date:** [November 4, 2019, 4:37pm UTC](https://discuss.elastic.co/t/what-roles-are-needed-for-a-user-to-create-write-delete-watchers/206440/1 "2019-11-04T16:37:22Z")

</div>

We have a user defined for this purpose which has the watcher\_admin role, but when we do a put to create a watcher we get the error msg: cluster:admin/script/put is unauthorized for this user.

If the watcher\_admin role is not sufficient, what else do we need?

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [November 4, 2019, 5:28pm UTC](https://discuss.elastic.co/t/what-roles-are-needed-for-a-user-to-create-write-delete-watchers/206440/2 "2019-11-04T17:28:11Z")

</div>

which Elasticsearch version are you on. Can you share the command you are using to store the watch?

---

<div class="post-metadata">

**Author:** ![Matt\_McGovern](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matt_mcgovern/32/90131_2.png) [@Matt\_McGovern](https://discuss.elastic.co/u/Matt_McGovern)\
**Post date:** [November 4, 2019, 6:39pm UTC](https://discuss.elastic.co/t/what-roles-are-needed-for-a-user-to-create-write-delete-watchers/206440/3 "2019-11-04T18:39:53Z")

</div>

Below are 2 curl commands that we use frequently, deleting and creating. In this case, I’m trying to create a stored script instead of a watcher. This is what is giving us the error.

curl --user user:password --request DELETE "[https://es.prod.business.comcast.com:443/\_scripts/getTopKeyValuesByCondition](https://es.prod.business.comcast.com:443/_scripts/getTopKeyValuesByCondition)" --cacert certfile.crt

curl --user user:password --header "Content-Type: application/json" --request POST "[https://es.prod.business.comcast.com:443/\_scripts/getTopKeyValuesByCondition](https://es.prod.business.comcast.com:443/_scripts/getTopKeyValuesByCondition)" --data-ascii "@curlstoredscript\_getTopKeyValuesByCondition.json" --cacert  
certfile.crt

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [November 5, 2019, 9:30am UTC](https://discuss.elastic.co/t/what-roles-are-needed-for-a-user-to-create-write-delete-watchers/206440/4 "2019-11-05T09:30:50Z")

</div>

if you want to store scripts, you need that particular privilege as well. On top of my head this is part of the `manage` cluster privilege.

I think it might make sense to allow storing/deleting/getting script as part of `manage_watcher`. I will open an issue for this.

---

<div class="post-metadata">

**Author:** ![Matt\_McGovern](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matt_mcgovern/32/90131_2.png) [@Matt\_McGovern](https://discuss.elastic.co/u/Matt_McGovern)\
**Post date:** [November 6, 2019, 7:23pm UTC](https://discuss.elastic.co/t/what-roles-are-needed-for-a-user-to-create-write-delete-watchers/206440/5 "2019-11-06T19:23:06Z")

</div>

Thank you!

---

<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:** [December 4, 2019, 7:23pm UTC](https://discuss.elastic.co/t/what-roles-are-needed-for-a-user-to-create-write-delete-watchers/206440/6 "2019-12-04T19:23:07Z")

</div>

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