skip to Main Content
def upload_to_grafana(json, server, api_key, verify=True):
'''
upload_to_grafana tries to upload dashboard to grafana and prints response
:param json - dashboard json generated by grafanalib
:param server - grafana server name
:param api_key - grafana api key with read and write privileges
'''

headers = {'Authorization': f"Bearer <apikey>","Accept": "application/json", 'Content-Type': 'application/json'}
r = requests.post(f"<endpoint url of the Azure managed grafana instance ", data=json, headers=headers, verify=False)
# TODO: add error handling
print(f"{r.status_code} - {r.content}")

I used this function to upload the dashboard created using python to the Azure managed Grafana instance .I assigned the user role as User Access administrator .When calling this function (using https )it returns 401 error and it returns connection error when using http. How do I solve this ..Thanks in advance for the help

2

Answers


  1. As per this MSFT doc of Troubleshoot issues for Azure Managed Grafana:

    • Restart the deployment of a new Managed Grafana instance. The Azure portal proposes Azure regions that aren’t accessible when starting a Managed Grafana instance for the first time.
    • Additionally, someone might have created a second instance with the same name simultaneously, or the name check may have failed earlier, resulting in a conflict afterwards. Create a new instance with a different name after deleting existing one.
    Login or Signup to reply.
  2. Make sure that you enable API key support on the Azure Managed Grafana resource. By default the service blocks API key requests, you need to explicitly turn it on. The service also supports using AAD service principals which might be a better option from a credential management standpoint.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search