How to create user in Elasticsearch with role "kibana_system" using super user "elastic" since Elastic user cannot be used for Kibana.yml configuration?
If Authentication is enabled on Elasticsearch, Kibana would expect the credentials to authenticate the user into Kibana system which needs to be configured in Kibana.yml .
- If "elastic" user credentials are preesnt, then use below powershell script to create the user in Elasticsearch with "kibana_system" role externally.
$user = "elastic" ---- Elastic user
$password = "" ------ default elastic user password for authenticating API call
$cred = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes("$user`:$password"))
$headers = @{
"Authorization" = "Basic $cred"
"Content-Type" = "application/json"
}
$body = @{
"password" = "kibana"
"roles" = @("kibana_system")
"full_name" = "Kibana"
"email" = "kibana_user@example.com"
} | ConvertTo-Json
Invoke-WebRequest -Method Post -Uri "https://{elastic_url}:9200/_security/user/kibana_user" -Headers $headers -Body $body
- The above request will create a user "kibana_user" with password "kibana" .