Skip to content

Commit c487406

Browse files
committed
updated
1 parent 17a6adc commit c487406

File tree

4 files changed

+26
-19
lines changed

4 files changed

+26
-19
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ To submit custom metrics to Azure Monitor, the entity that submits the metric ne
4747
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

50-
[!INCLUDE [Get a token](../includes/get-a-token.md)]
50+
[!INCLUDE [Get a token](../includes/get-authentication-token.md)]
5151

5252
Save the access token from the response for use in the following HTTP requests.
5353

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Request submitted using the Azure Monitor API use the Azure Resource Manager aut
2222
### Retrieve a token
2323
Once you've created a service principal, retrieve an access token. Specify `resource=https://management.azure.com` in the token request.
2424

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

2727

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

articles/azure-monitor/includes/get-a-token.md renamed to articles/azure-monitor/includes/get-authentication-token.md

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,19 @@ ms.author: edbaynash
66
author: EdB-MSFT
77
---
88

9-
Get a token using any of the following
9+
Get an authentication token using any of the following methods:
1010
- CLI
1111
- REST API
1212
- SDK
1313

14-
When requesting a token, you need to provide a `resource` parameter. The `resource` parameter is the URL of the resource you want to access.
14+
When requesting a token, you must provide a `resource` parameter. The `resource` parameter is the URL of the resource you want to access.
1515

1616
Resources include:
1717
- https://management.azure.com
1818
- https://api.loganalytics.io
1919
- https://monitoring.azure.com
2020

2121

22-
23-
2422
## [REST](#tab/rest)
2523

2624
Use the following REST API call to get a token.
@@ -51,7 +49,7 @@ The response body appears in the following format:
5149
```
5250

5351
## [CLI](#tab/cli)
54-
52+
### Get a token Azure CLI
5553
To get a token using CLI, you can use the following command
5654

5755
```bash
@@ -61,10 +59,13 @@ az account get-access-token
6159
For more information, see [az account get-access-token](/cli/azure/account?view=azure-cli-latest#az-account-get-access-token)
6260

6361
## [SDK](#tab/SDK)
62+
### Get a token using the SDKs
63+
The following code samples show how to get a token using:
64+
+ C#
65+
+ NodeJS
66+
+ Python
6467

65-
Use the SDK to get a token. The following code samples show how to get a token using C#, NodeJS, and Python.
66-
67-
#### .NET
68+
#### C#
6869

6970
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.
7071
```csharp
@@ -73,7 +74,7 @@ var clientCredential = new ClientCredential("<your apps client ID>", "<your apps
7374
var result = context.AcquireTokenAsync("https://monitoring.azure.com", clientCredential).Result;
7475
```
7576

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.
77+
Alternatively, you can use the DefaultAzureCredential class to get a token. This method uses the default Azure credentials to authenticate the request and doesn't require a client ID or client secret.
7778

7879
```csharp
7980
var credential = new DefaultAzureCredential();
@@ -102,17 +103,20 @@ For more information, see [DefaultAzureCredential Class](/dotnet/api/azure.ident
102103
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)
103104

104105

105-
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.
106+
The following code shows how to get a token using the DefaultAzureCredential class. This method uses the default Azure credentials to authenticate the request and doesn't require a client ID or client secret.
106107

107108
```javascript
108109
const { DefaultAzureCredential } = require("@azure/identity");
109110

110111
const credential = new DefaultAzureCredential();
111112
const accessToken = await credential.getToken("https://management.azure.com/.default");
112113
```
113-
For more information, see [DefaultAzureCredential Class](/javascript/api/@azure/identity/defaultazurecredential?view=azure-node-latest)
114114

115-
Alternatively you can use the ClientSecretCredential class to get a token. This requires a client ID and client secret to authenticate the request.
115+
You can also use the `InteractiveBrowserCredential` class to get the credentials. This method provides a browser-based authentication experience for users to authenticate with Azure services.
116+
117+
For more information, see [DefaultAzureCredential Class](/javascript/api/@azure/identity/defaultazurecredential?view=azure-node-latest) and [InteractiveBrowserCredential Class](/javascript/api/@azure/identity/interactivebrowsercredential?view=azure-node-latest)
118+
119+
Alternatively you can use the ClientSecretCredential class to get a token. This method requires a client ID and client secret to authenticate the request.
116120

117121
```javascript
118122
const { ClientSecretCredential } = require("@azure/identity");
@@ -127,7 +131,7 @@ For more information, see [ClientSecretCredential Class](/javascript/api/@azure/
127131

128132
#### Python
129133

130-
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.
134+
The following code shows how to get a token using the DefaultAzureCredential class. This method uses the default Azure credentials to authenticate the request and doesn't require a client ID or client secret.
131135

132136
```python
133137
from azure.identity import DefaultAzureCredential
@@ -136,9 +140,12 @@ credential = DefaultAzureCredential()
136140
token = credential.get_token('https://management.azure.com/.default')
137141
print(token.token)
138142
```
139-
For more information, see [DefaultAzureCredential Class](/python/api/azure-identity/azure.identity.defaultazurecredential?view=azure-python)
140143

141-
Alternatively you can use the ClientSecretCredential class to get a token. This requires a client ID and client secret to authenticate the request.
144+
You can also use the `InteractiveBrowserCredential` class to get the credentials. This method provides a browser-based authentication experience for users to authenticate with Azure services.
145+
146+
For more information, see [DefaultAzureCredential Class](/python/api/azure-identity/azure.identity.defaultazurecredential?view=azure-python) and [InteractiveBrowserCredential Class](/python/api/azure-identity/azure.identity.interactivebrowsercredential?view=azure-python)
147+
148+
Alternatively you can use the ClientSecretCredential class to get a token. This method requires a client ID and client secret to authenticate the request.
142149

143150
```python
144151
from azure.identity import ClientSecretCredential
@@ -148,7 +155,7 @@ credential = ClientSecretCredential (
148155
client_id="<Client id>",
149156
client_secret="client secret"
150157
)
151-
token = credential2.get_token("https://management.azure.com/.default")
158+
token = credential.get_token("https://management.azure.com/.default")
152159
print(token.token)
153160
```
154161

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ In the client credentials flow, the token is used with the Log Analytics endpoin
122122

123123
Use `resource=https://api.loganalytics.azure.com`.
124124

125-
[!INCLUDE [Get a token](../../includes/get-a-token.md)]
125+
[!INCLUDE [Get a token](../../includes/get-authentication-token.md)]
126126

127127

128128
Use the token in requests to the Log Analytics endpoint:

0 commit comments

Comments
 (0)