-
Hello everyone, I’m encountering an issue with Grafana and would appreciate your help. Here’s the relevant information:
-
What Grafana version and operating system are you using?
Grafana OSS 12.2.0, Docker -
What are you trying to achieve?
I want to use a service account token to create alert rules via API -
How are you trying to achieve it?
I’m sending a POST request to /api/alerting-provisioning/rules with a JSON body, using the service account’s Bearer token -
What happened?
The response was Error: status: 403, body: {“accessErrorId”:“ACE5486629262”,“message”:“You’ll need additional permissions to perform this action. Permissions needed: alert.provisioning:write”,“title”:“Access denied”} -
What did you expect to happen?
I expected the alert rule to be created successfully -
Can you copy/paste the configuration(s) that you are having problems with?
docker run -d -p 3000:3000 --name=grafana
-e “GF_SECURITY_ALLOW_EMBEDDING=true”
-e “GF_DATABASE_TYPE=postgres”
-e “GF_DATABASE_HOST=myDB:5432”
-e “GF_DATABASE_NAME=grafana”
-e “GF_DATABASE_USER=mysuer”
-e “GF_DATABASE_PASSWORD=mypassword”
-e “GF_DATABASE_SSL_MODE=verify-full”
-e “GF_AUTH_ANONYMOUS_ENABLED=true”
grafana/grafana:latest -
Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
The response was Error: status: 403, body: {“accessErrorId”:“ACE5486629262”,“message”:“You’ll need additional permissions to perform this action. Permissions needed: alert.provisioning:write”,“title”:“Access denied”} -
Did you follow any online instructions? If so, what is the URL?
Grafana Doc
-
I have tried to set up the service account token directly via the Swagger interface, but I still get the same error. However, using the Grafana UI I can successfully create alerts.
May I ask if there is any additional configuration I need to enable? Or is the API for creating alerts not supported in OSS Grafana?
I’ve ensured that the service account has been assigned the “Editor” or “Admin” role, which should grant the necessary permissions to create alerts.
Thanks in advance for any help!
