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/azure-monitor/essentials/rest-api-walkthrough.md
+8-11Lines changed: 8 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,12 +16,7 @@ Retrieve metric definitions, dimension values, and metric values using the Azure
16
16
17
17
## Authenticate Azure Monitor requests
18
18
19
-
Request submitted using the Azure Monitor API use the Azure Resource Manager authentication model. All requests are authenticated with Azure Active Directory. One approach to authenticating the client application is to create an Azure Active Directory service principal and retrieve the authentication token. See
20
-
21
-
## Create an Azure Active Directory service principal
22
-
23
-
You can create an Azure Active Directory service principal using the Azure portal, CLI, or PowerShell. For more information, see [Register an App to request authorization tokens and work with APIs](../logs/api/register-app-for-token)
24
-
19
+
Request submitted using the Azure Monitor API use the Azure Resource Manager authentication model. All requests are authenticated with Azure Active Directory. One approach to authenticating the client application is to create an Azure Active Directory service principal and retrieve an authentication token. You can create an Azure Active Directory service principal using the Azure portal, CLI, or PowerShell. For more information, see [Register an App to request authorization tokens and work with APIs](../logs/api/register-app-for-token)
25
20
26
21
## Retrieve a token
27
22
Once you've created a service principal, retrieve an access token using a REST call. Submit the following request using the `appId` and `password` for your service principal or app:
@@ -194,7 +189,7 @@ In this example, only the second metric has dimensions.
194
189
195
190
After the retrieving the available metric definitions, retrieve the range of values for the metric's dimensions. Use dimension values to filter or segment the metrics in your queries. Use the [Azure Monitor Metrics REST API](/rest/api/monitor/metrics) to find all of the values for a given metric dimension.
196
191
197
-
Use the metric's `name.value` element for filtering requests. If no filters are specified, the default metric is returned. The API only allows one dimension to have a wildcard filter.
192
+
Use the metric's `name.value` element in the filter definitions. If no filters are specified, the default metric is returned. The API only allows one dimension to have a wildcard filter.
198
193
Specify the request for dimension values using the `"resultType=metadata"` query parameter. The `resultType` is omitted for a metric values request.
199
194
200
195
> [!NOTE]
@@ -214,7 +209,7 @@ Host: management.azure.com
214
209
Content-Type: application/json
215
210
Authorization: Bearer <access token>
216
211
```
217
-
For example, to retrieve the list of dimension values that were emitted for the `API Name` dimension for the `Transactions` metric, where the GeoType dimension = `Primary` during the specified time range, the request would be:
212
+
The following example retrieves the list of dimension values that were emitted for the `API Name` dimension of the `Transactions` metric, where the `GeoType` dimension has a value of `Primary`, for the specified time range.
218
213
219
214
```curl
220
215
curl --location --request GET 'https://management.azure.com/subscriptions/12345678-abcd-98765432-abcdef012345/resourceGroups/azmon-rest-api-walkthrough/providers/Microsoft.Storage/storageAccounts/ContosoStorage/providers/microsoft.insights/metrics \
@@ -274,9 +269,9 @@ The following JSON shows an example response body.
274
269
275
270
## Retrieve metric values
276
271
277
-
After the available metric definitions and dimension values are known, you can then retrieve the metric values. Use the [Azure Monitor Metrics REST API](/rest/api/monitor/metrics) to retrieve the metric values.
272
+
After retrieving the metric definitions and dimension values, retrieve the metric values. Use the [Azure Monitor Metrics REST API](/rest/api/monitor/metrics) to retrieve the metric values.
278
273
279
-
Use the metric's `name.value` element (not `localizedValue`) for any filtering requests. If no dimension filters are specified, the rolled up, aggregated metric is returned.
274
+
Use the metric's `name.value` element in the filter definitions. If no dimension filters are specified, the rolled up, aggregated metric is returned.
280
275
281
276
To fetch multiple time series with specific dimension values, specify a filter query parameter that specifies both dimension values such as `"&$filter=ApiName eq 'ListContainers' or ApiName eq 'GetBlobServiceProperties'"`.
For example, to retrieve the top three APIs, in descending value, by the number of `Transactions` during a 5-minute range, where the GeoType was`Primary`, the request would be:
293
+
The following example retrieves the top three APIs, by the number of `Transactions`in descending value order, during a 5-minute range, where the GeoType is`Primary`.
299
294
300
295
```curl
301
296
curl --location --request GET 'https://management.azure.com/subscriptions/12345678-abcd-98765432-abcdef012345/resourceGroups/azmon-rest-api-walkthrough/providers/Microsoft.Storage/storageAccounts/ContosoStorage/providers/microsoft.insights/metrics \
@@ -482,6 +477,8 @@ The result should be similar to the following example:
482
477
483
478
Use the Azure Monitor REST API to query [activity log](/rest/api/monitor/activitylogs) data.
484
479
480
+
Use the following request format for activity log queries.
481
+
485
482
```curl
486
483
GET /subscriptions/<subscriptionId>/providers/Microsoft.Insights/eventtypes/management/values \
0 commit comments