Datasource provisioning error. Only one datasource per organization can be marked as default

  • What Grafana version and what operating system are you using?
    grafana:8.2.5 , inside docker container ubuntu 5.15.0

  • What are you trying to achieve?
    grafana is running on docker container, so my datasource configuration should be in yml file while loading the container rather adding it on UI manually

  • How are you trying to achieve it?
    Inside the /etc/grafana/provisioning/datasources, I am trying to add datasource yaml file for azure monitor, But already I have promotheus yml (prometheus.yml) file.

I am not sure, is it technically possible to have more than one .yml file or I need to have both the configurations in one yml file

  • What happened?
    After I added yml file for azure monitor datasource, the docker container failed to start

  • What did you expect to happen?
    My expectation is we need to add this configuration through yml file instead of manually doing from UI.

  • Can you copy/paste the configuration(s) that you are having problems with?
    File path: /etc/grafana/provisioning/datasources

grafana.yml file

apiVersion: 1
datasources:
- name: Grafana
  type: grafana-azure-data-explorer-datasource
  isDefault: true
  access: proxy
  editable: true
  jsonData:
      azureAuthType: clientsecret
      cloudName: azuremonitor # See table below
      tenantId: {{ vault_AZ_TENANT_ID }}
      clientId: {{ vault_AZ_CLIENT_ID }}
  secureJsonData:
      clientSecret: {{ vault_AZ_SECRET }}

prometheus yml file

apiVersion: 1
datasources:
- name: Prometheus
  type: prometheus
  url: http://prometheus:9090
  isDefault: true
  access: proxy
  editable: true
  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
grafana             | Failed to start grafana. error: Datasource provisioning error: datasource.yaml config is invalid. Only one datasource per organization can be marked as default
grafana             | Datasource provisioning error: datasource.yaml config is invalid. Only one datasource per organization can be marked as default
  • Did you follow any online instructions? If so, what is the URL?
    No I didnt yet follow any

Exactly, what is saying error message:

Only one datasource can have that isDefault: true. Not two datasources, what’s your case.

This is my error message:

Failed to start grafana. error: Datasource provisioning error: datasource.yaml config is invalid. Only one datasource per organization can be marked as default
Datasource provisioning error: datasource.yaml config is invalid. Only one datasource per organization can be marked as default