Skip to content

Commit 54b7108

Browse files
committed
add more articles
1 parent e36eadb commit 54b7108

File tree

5 files changed

+12
-56
lines changed

5 files changed

+12
-56
lines changed

articles/azure-monitor/app/azure-ad-authentication.md

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -294,31 +294,9 @@ The Application Insights API supports Microsoft Entra authentication with three
294294

295295
In the client credentials flow, the token is used with the Application Insights endpoint. A single request is made to receive a token by using the credentials provided for your app in the previous step when you [register an app in Microsoft Entra ID](../logs/api/register-app-for-token.md).
296296

297-
Use the `https://api.applicationinsights.io` endpoint.
297+
Use `resource=https://api.applicationinsights.io`.
298298

299-
##### Client credentials token URL (POST request)
300-
301-
```http
302-
POST /<your-tenant-id>/oauth2/token
303-
Host: https://login.microsoftonline.com
304-
Content-Type: application/x-www-form-urlencoded
305-
306-
grant_type=client_credentials
307-
&client_id=<app-client-id>
308-
&resource=https://api.applicationinsights.io
309-
&client_secret=<app-client-secret>
310-
```
311-
312-
A successful request receives an access token in the response:
313-
314-
```http
315-
{
316-
token_type": "Bearer",
317-
"expires_in": "86399",
318-
"ext_expires_in": "86399",
319-
"access_token": ""eyJ0eXAiOiJKV1QiLCJ.....Ax"
320-
}
321-
```
299+
[!INCLUDE [Get a token](../../includes/get-a-token.md)]
322300

323301
Use the token in requests to the Application Insights endpoint:
324302

articles/azure-monitor/essentials/metrics-store-custom-rest-api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ To submit custom metrics to Azure Monitor, the entity that submits the metric ne
4444
4545
### Get an authorization token
4646

47-
Once you have created your managed identity or service principal and assigned **Monitoring Metrics Publisher** permissions, you can get an authorization token by using the following methods:
47+
Once you have created your managed identity or service principal and assigned **Monitoring Metrics Publisher** permissions, you can get an authorization token by using the following methods.
4848
When requesting a token specify `resource: https://monitoring.azure.com`.
4949

5050
[!INCLUDE [Get a token](../includes/get-a-token.md)]

articles/azure-monitor/essentials/rest-api-walkthrough.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,11 @@ Retrieve metric definitions, dimension values, and metric values using the Azure
2020
Request submitted using the Azure Monitor API use the Azure Resource Manager authentication model. All requests are authenticated with Microsoft Entra ID. One approach to authenticating the client application is to create a Microsoft Entra service principal and retrieve an authentication token. You can create a Microsoft Entra 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.md).
2121

2222
### Retrieve a token
23-
Once you've created a service principal, retrieve an access token. specify resource=https://management.azure.com in the request to get a token.
23+
Once you've created a service principal, retrieve an access token. Specify `resource=https://management.azure.com` in the token request.
2424

2525
[!INCLUDE [Get a token](../includes/get-a-token.md)]
2626

2727

28-
2928
After authenticating and retrieving a token, use the access token in your Azure Monitor API requests by including the header `'Authorization: Bearer <access token>'`
3029

3130
> [!NOTE]

articles/azure-monitor/includes/get-a-token.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ For more information, see [az account get-access-token](/cli/azure/account?view=
6262

6363
## [SDK](#tab/SDK)
6464

65-
You can use the SDK to get a token. The following code is an example of how to get a token using the SDK.
65+
Use the SDK to get a token. The following code samples show how to get a token using C#, NodeJS, and Python.
6666

67-
### .NET
67+
#### .NET
6868

6969
The following code shows how to get a token using the Azure. Identity library It requires a client ID and client secret to authenticate the request.
7070
```csharp
@@ -73,7 +73,7 @@ var clientCredential = new ClientCredential("<your apps client ID>", "<your apps
7373
var result = context.AcquireTokenAsync("https://monitoring.azure.com", clientCredential).Result;
7474
```
7575

76-
Alternatively you can use the DefaultAzureCredential class to get a token. This uses the default Azure credentials to authenticate the request and doesn't require a client ID or client secret.
76+
Alternatively, you can use the DefaultAzureCredential class to get a token. This uses the default Azure credentials to authenticate the request and doesn't require a client ID or client secret.
7777

7878
```csharp
7979
var credential = new DefaultAzureCredential();
@@ -97,7 +97,7 @@ var token = credential.GetToken(new TokenRequestContext(new[] { "https://managem
9797
For more information, see [DefaultAzureCredential Class](/dotnet/api/azure.identity.defaultazurecredential?view=azure-dotnet)
9898

9999

100-
### Node.js
100+
#### Node.js
101101

102102
For information on authentication use JavaScript and NodeJS, see [How to authenticate JavaScript apps to Azure services using the Azure SDK for JavaScript](/azure/developer/javascript/sdk/authentication/overview)
103103

@@ -125,7 +125,7 @@ const accessToken = await credential.getToken("https://management.azure.com/.def
125125
```
126126
For more information, see [ClientSecretCredential Class](/javascript/api/@azure/identity/clientsecretcredential?view=azure-node-latest)
127127

128-
### Python
128+
#### Python
129129

130130
The following code shows how to get a token using the DefaultAzureCredential class. This uses the default Azure credentials to authenticate the request and doesn't require a client ID or client secret.
131131

@@ -152,6 +152,6 @@ token = credential2.get_token("https://management.azure.com/.default")
152152
print(token.token)
153153
```
154154

155-
For more information see [ClientSecretCredential Class](/python/api/azure-identity/azure.identity.clientsecretcredential?view=azure-python)
155+
For more information, see [ClientSecretCredential Class](/python/api/azure-identity/azure.identity.clientsecretcredential?view=azure-python)
156156

157157
---

articles/azure-monitor/logs/api/access-api.md

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -120,31 +120,10 @@ The Log Analytics API supports Microsoft Entra authentication with three differe
120120

121121
In the client credentials flow, the token is used with the Log Analytics endpoint. A single request is made to receive a token by using the credentials provided for your app in the previous step when you [register an app in Microsoft Entra ID](./register-app-for-token.md).
122122

123-
Use the `https://api.loganalytics.azure.com` endpoint.
123+
Use `resource=https://api.loganalytics.azure.com`.
124124

125-
#### Client credentials token URL (POST request)
125+
[!INCLUDE [Get a token](./includes/get-a-token.md)]
126126

127-
```http
128-
POST /<your-tenant-id>/oauth2/token
129-
Host: https://login.microsoftonline.com
130-
Content-Type: application/x-www-form-urlencoded
131-
132-
grant_type=client_credentials
133-
&client_id=<app-client-id>
134-
&resource=https://api.loganalytics.io
135-
&client_secret=<app-client-secret>
136-
```
137-
138-
A successful request receives an access token in the response:
139-
140-
```http
141-
{
142-
token_type": "Bearer",
143-
"expires_in": "86399",
144-
"ext_expires_in": "86399",
145-
"access_token": ""eyJ0eXAiOiJKV1QiLCJ.....Ax"
146-
}
147-
```
148127

149128
Use the token in requests to the Log Analytics endpoint:
150129

0 commit comments

Comments
 (0)