Skip to content

Commit d375678

Browse files
authored
Merge pull request #2 from maud-lv/patch-32
PR suggestions
2 parents 9edae37 + 622d26d commit d375678

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

articles/managed-grafana/how-to-api-calls.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ author: maud-lv
66
ms.author: malev
77
ms.service: managed-grafana
88
ms.topic: tutorial
9-
ms.date: 03/23/2023
9+
ms.date: 04/05/2023
1010
ms.custom: engagement-fy23
1111
---
1212

@@ -83,29 +83,32 @@ You now need to gather some information, which you'll use to get a Grafana API a
8383

8484
## Get an access token
8585

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.
8787

88-
### Get an access token using the Azure Command-Line Interface (CLI)
88+
### [Azure CLI](#tab/azure-cli)
8989

90-
Replace `<tenant-id>`, `<client-id>`, and `<client-secret>` with the tenant ID, application (client) ID, and client secret collected 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:
9191

9292
```
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>"
9494
```
9595

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:
9797

9898
```
99-
az grafana api-key create --key keyname --name <name> -g <rg> -r editor -o json
100-
You will only be able to view this key here once. Please save it in a secure place.
99+
az grafana api-key create --key keyname --name <name> --resource-group <rg> --resource-group editor --output json
100+
101101
{
102102
"id": 3,
103103
"key": "<redacted>",
104104
"name": "keyname"
105105
}
106106
```
107107

108-
### Get an access token using a POST request
108+
> [!NOTE]
109+
> You can only view this key here once. Save it in a secure place.
110+
111+
### [POST request](#tab/post)
109112

110113
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.
111114

@@ -129,6 +132,8 @@ Here's an example of response:
129132
}
130133
```
131134

135+
---
136+
132137
## Call Grafana APIs
133138

134139
You can now call Grafana APIs using the access token retrieved in the previous step as the Authorization header. For example:

0 commit comments

Comments
 (0)