I’m running Grafana in a Docker container and trying to automatically add a read-only (Viewer) user during startup.
Unfortunately, it seems you can’t create users via grafana CLI or YAML config files directly. The only method that works for me is using the REST API on host:
curl -X POST \
-H "Content-Type: application/json" \
-u "admin:group" \
-d '{
"name": "Viewer User",
"email": "viewer@company.com",
"login": "viewer",
"password": "viewer-password",
"role": "Viewer"
}' \
http://localhost:3000/api/admin/users
But this has to wait until the Grafana container is fully running when deployed to the cloud, because I also load plugins, dashboard JSON, and config YAML during startup. What’s the proper way to automate adding a non-admin user?