- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How could I add a new role from the CLI or REST API?
I am adding new users externally from a script and some of them needs to have a new separate role with Restricted search terms.
One solution could be to change the conf files and restart Splunk. Is there a more elegant answer to my problem?
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As far as I know there is no such functionality built in as a CLI parameter, however if you want to add roles programatically you can use the REST API: http://docs.splunk.com/Documentation/Splunk/latest/RESTAPI/RESTaccess#authorization.2Froles
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can do this a couple ways:
Through the CLI you can use the Splunk_TA_aws/bin/tools/configure/configure.py script with the following command:
/opt/splunk/bin/splunk cmd python aws_config_cli.py iam-role create --config-file input.json --hostname localhost
Create your input.json and splunk-info.json files based on the samples found in Splunk_TA_aws/bin/tools/configure/config_examples
You can also manually edit the password.conf and splunk_ta_aws_iam_roles.conf files in Splunk_TA_aws/local
Here's a passwords.conf example:
[credential:__REST_CREDENTIAL__#Splunk_TA_aws#configs/conf-splunk_ta_aws_iam_roles#BaseRestHandler:my-iam-role:]
password =
Here's a splunk_ta_aws_iam_roles.conf example:
[my-iam-role]
arn = arn:aws:iam::<aws_account_id>:role/my-iam-role
They key is to leave the password entry blank since the "credential" value isn't encrypted.
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As far as I know there is no such functionality built in as a CLI parameter, however if you want to add roles programatically you can use the REST API: http://docs.splunk.com/Documentation/Splunk/latest/RESTAPI/RESTaccess#authorization.2Froles
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Correcting myself here - while there is no 'shortcut' to doing this using the CLI, what you can do is issue REST requests using the CLI. See this blog post: http://blogs.splunk.com/2009/12/10/poke-at-our-api/
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Do you not have SplunkWeb access? You can add roles directly via the manager view.
