grafana-sync icon indicating copy to clipboard operation
grafana-sync copied to clipboard

Work with ServiceAccounts bearer tokens in place of API Keys

Open vineethvijay7 opened this issue 1 year ago • 5 comments

In latest Grafana version, we longer has the API Keys available. Was wondering if there is a hack/update to make this amazing tool to work with the alternative "ServiceAccounts bearer tokens"

vineethvijay7 avatar Jan 26 '24 13:01 vineethvijay7

What error you are getting when trying to use it with service account token? I don't expect it to work differently

mpostument avatar Jan 26 '24 14:01 mpostument

Error:

./grafana-sync push-dashboards --apikey="SERVICE_ACCOUNT_TOKEN_HERE=" --directory="dashboards" --url http://my-domain.com
2024/02/01 15:12:53 error on importing dashboard my-dashboard
...

The token has necessary permissions and has been tested using grafana api.

But I suppose the problem might be also transparent from the command, it is supposed to be working with just apikey ?

vineethvijay7 avatar Feb 01 '24 14:02 vineethvijay7

I will try to look at this. But if new token is not supported, not sure if i will be able to do something. Looks like grafana sdk is no longer active

https://github.com/grafana-tools/sdk

mpostument avatar Feb 06 '24 12:02 mpostument

@vineethvijay7 i tried on grafana 10.2, service account with editor role. And i was able to pull folder, dashboards

mpostument avatar Feb 06 '24 12:02 mpostument

Also tried grafana 10.3. Service account with editor permissions, was able to do pull and push

mpostument avatar Feb 06 '24 12:02 mpostument