You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/managed-grafana/how-to-api-calls.md
+14-9Lines changed: 14 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ author: maud-lv
6
6
ms.author: malev
7
7
ms.service: managed-grafana
8
8
ms.topic: tutorial
9
-
ms.date: 03/23/2023
9
+
ms.date: 04/05/2023
10
10
ms.custom: engagement-fy23
11
11
---
12
12
@@ -83,29 +83,32 @@ You now need to gather some information, which you'll use to get a Grafana API a
83
83
84
84
## Get an access token
85
85
86
-
To access Grafana APIs, you need to get an access token. You can get the access token using the Azure Command-Line Interface (CLI) or making a POST request.
86
+
To access Grafana APIs, you need to get an access token. You can get the access token using the Azure CLI or making a POST request.
87
87
88
-
### Get an access token using the Azure Command-Line Interface (CLI)
88
+
### [Azure CLI](#tab/azure-cli)
89
89
90
-
Replace `<tenant-id>`, `<client-id>`, and `<client-secret>` with the tenant ID, application (client) ID, and client secretcollected in the previous step and login with Azure CLI:
90
+
Sign in to the Azure CLI by running the [az login](/cli/azure/reference-index#azlogin) command and replace `<client-id>`, `<client-secret>`, and `<tenant-id>` with the application (client) ID, client secret, and tenant ID collected in the previous step:
91
91
92
92
```
93
-
az login --service-principal -u "<client-id>" -p "client-secret>" --tenant "<tenant-id>"
93
+
az login --service-principal --username "<client-id>" --password "<client-secret>" --tenant "<tenant-id>"
94
94
```
95
95
96
-
Use the command `az grafana api-key create` to create a key, here is an example output:
96
+
Use the command [az grafana api-key create](/cli/azure/grafana/api-key#az-grafana-api-key-create) to create a key. Here's an example output:
> You can only view this key here once. Save it in a secure place.
110
+
111
+
### [POST request](#tab/post)
109
112
110
113
Follow the example below to call Azure AD and retrieve a token. Replace `<tenant-id>`, `<client-id>`, and `<client-secret>` with the tenant ID, application (client) ID, and client secret collected in the previous step.
111
114
@@ -129,6 +132,8 @@ Here's an example of response:
129
132
}
130
133
```
131
134
135
+
---
136
+
132
137
## Call Grafana APIs
133
138
134
139
You can now call Grafana APIs using the access token retrieved in the previous step as the Authorization header. For example:
0 commit comments