I am not able to export data sources in Grafana with basic auth details.
As I searched on internet, people are downloading datasource JSON by URL <grafana>/api/datasources
and uploading same way with another API.
I tried doing that. Everything works fine but for basic auth info, only basicAuth: true
is downloaded from above rest call as JSON but not password info. So, importing that JSON does not create proper datasource in Grafana.
Is there a way to smoothly export then import JSON to Grafana for data sources?( Specially for Prometheus data sources)
Thanks in advance.
Updating my scenario here:
What is the requirement: I want my Grafana data sources which have basic auth enabled to get exported and imported to client site:
Why it is needed: It is needed because in my one use case, I configured Prometheus datasource with basic auth and tried exported as json and pushed to GIT. And with help of Jenkins (CI/CD), I needed them to be created/updated in UAT deployment and then to customers with same approach.
Everything was working fine until I did not enable basic auth in Prometheus. Once, I enabled, This continuous integration is breaking because Grafana in UAT and Clients are not working with Prometheus due to Auth issue (because basic auth configs are not exported in JSON):
Can anyone help me resolving this scenario?