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/metrics-store-custom-rest-api.md
+11-11Lines changed: 11 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,11 +20,11 @@ To send metrics for resources in other environments or on-premises, use [Applica
20
20
21
21
A service principal is an application whose tokens can be used to authenticate and grant access to specific Azure resources using Azure Active Directory. This includes user-apps, services or automation tools.
22
22
23
-
1.Register application and create a service principal in your Azure Active Directory tenant by using the instructions found at [Register an application with Azure Active Directory](../logs/api/register-app-for-token.md).
23
+
1.[Register an application with Azure Active Directory](../logs/api/register-app-for-token.md) to create a service principal.
24
24
25
25
1. Save the tenant ID, new client ID, and client secret value for your app to use when requesting a token.
26
26
27
-
1. Give the app created as part of the previous step,**Monitoring Metrics Publisher** permissions to the resource you wish to emit metrics against. If you plan to use the app to emit custom metrics against many resources, you can grant these permissions at the resource group or subscription level.
27
+
1. Give the app created as part of the previous step **Monitoring Metrics Publisher** permissions to the resource you wish to emit metrics against. If you plan to use the app to emit custom metrics against many resources, you can grant these permissions at the resource group or subscription level.
28
28
29
29
On your resource's overview page, select **Access Control (IAM)**
30
30
1. Select **Add**, then **Add role assignment** from the dropdown.
@@ -106,12 +106,12 @@ Save the access token from the response for use in the following HTTP requests.
106
106
- **resourceId**: Resource ID of the Azure resource you're tracking the metric against.
107
107
- **accessToken**: The authorization token acquired from the previous step.
108
108
109
-
```Shell
110
-
curl -X POST 'https://<location>.monitoring.azure.com/<resourceId>/metrics' \
111
-
-H 'Content-Type: application/json' \
112
-
-H 'Authorization: Bearer <accessToken>' \
113
-
-d @custommetric.json
114
-
```
109
+
```Shell
110
+
curl -X POST 'https://<location>.monitoring.azure.com/<resourceId>/metrics' \
111
+
-H 'Content-Type: application/json' \
112
+
-H 'Authorization: Bearer <accessToken>' \
113
+
-d @custommetric.json
114
+
```
115
115
116
116
1. Change the timestamp and values in the JSON file.
117
117
1. Repeat the previous two steps a number of times, to create data for several minutes.
@@ -120,9 +120,9 @@ curl -X POST 'https://<location>.monitoring.azure.com/<resourceId>/metrics' \
120
120
121
121
If you receive an error message with some part of the process, consider the following troubleshooting information:
122
122
123
-
* You can't issue metrics against a subscription or resource group, or resource, check that your application or Service Principal has the **Monitoring Metrics Publisher** role assigned in Access control (IAM).
124
-
* The number of dimension names must match the values. Check the values and dimentions.
125
-
* You might be emitting metrics against a region that doesn’t support custom metrics. See [supported regions](./metrics-custom-overview.md#supported-regions).
123
+
- If you can't issue metrics against a subscription or resource group, or resource, check that your application or Service Principal has the **Monitoring Metrics Publisher** role assigned in Access control (IAM).
124
+
- Check that the number of dimension names matches the number values.
125
+
- Check that you are not emitting metrics against a region that doesn’t support custom metrics. See [supported regions](./metrics-custom-overview.md#supported-regions).
Copy file name to clipboardExpand all lines: articles/azure-monitor/logs/api/register-app-for-token.md
+7-5Lines changed: 7 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ ms.topic: article
9
9
10
10
# Register an App to request authorization tokens and work with APIs
11
11
12
-
To access Azure REST APIs such as the Log analytics API, or to send custom metrics, you can generate an authorization token based on a client ID and secret. The token is then passed in your REST API request. This article shows you how to register a client app and assign permissions to access so that you can generate a token.
12
+
To access Azure REST APIs such as the Log analytics API, or to send custom metrics, you can generate an authorization token based on a client ID and secret. The token is then passed in your REST API request. This article shows you how to register a client app and create a client secret so that you can generate a token.
13
13
14
14
## Register an App
15
15
@@ -41,13 +41,15 @@ To access Azure REST APIs such as the Log analytics API, or to send custom metri
41
41
## Next steps
42
42
43
43
Before you can generate a token using your app, client ID, and secret, assign the app to a role using Access control (IAM) for resource that you want to access.
44
-
The role will depend on the resource time, and the API that you want to use.
44
+
The role will depend on the resource type and the API that you want to use.
45
+
For example,
46
+
- To grant your app read from a Log Analytics Workspace, add your app as a member to the **Reader** role using Access control (IAM) for your Log Analytics Workspace. For more information, see [Access the API](./access-api.md)
45
47
46
-
* To grant your app read from a Log Analytics Workspace, add your app as a member to the **Reader** role using Access control (IAM) for your Log Analytics Workspace. For more information, see [Access the API](./access-api.md)
48
+
- To grant access to send custom metrics for a resource, add your app as a member to the **Monitoring Metrics Publisher** role using Access control (IAM) for your resource. For more information, see [ Send metrics to the Azure Monitor metric database using REST API](../../essentials/metrics-store-custom-rest-api.md)
47
49
48
-
* To grant access to send custom metrics for a resource, add your app as a member to the **Monitoring Metrics Publisher** role using Access control (IAM) for your resource. For more information, see [ Send metrics to the Azure Monitor metric database using REST API](../../essentials/metrics-store-custom-rest-api.md)
50
+
For more information see [Assign Azure roles using the Azure portal](https://learn.microsoft.com/azure/role-based-access-control/role-assignments-portal)
49
51
50
-
Once you have roles and permission setup, you can use your client ID and client secret to generate a bearer token to access the REST API.
52
+
Once you have assigned a role you can use your app, client ID, and client secret to generate a bearer token to access the REST API.
51
53
52
54
> [!NOTE]
53
55
> When using Azure AD authentication, it may take up to 60 minutes for the Azure Application Insights REST API to recognize new role-based access control (RBAC) permissions. While permissions are propagating, REST API calls may fail with error code 403.
0 commit comments