Skip to content

Commit e3a89ab

Browse files
committed
applying several Engr feedback and suggestions
1 parent 72a1a28 commit e3a89ab

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

articles/ai-foundry/foundry-models/how-to/use-chat-completions.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,12 @@ const client = new OpenAI();
197197

198198
**Microsoft Entra authentication**:
199199

200+
First install the Azure Identity client library before you can use DefaultAzureCredential:
201+
202+
```bash
203+
npm install @azure/identity
204+
```
205+
200206
```javascript
201207
const tokenProvider = getBearerTokenProvider(
202208
new DefaultAzureCredential(),
@@ -229,6 +235,12 @@ client := openai.NewClient()
229235

230236
**Microsoft Entra authentication**:
231237

238+
Install the Azure Identity module first:
239+
240+
```bash
241+
go get -u github.com/Azure/azure-sdk-for-go/sdk/azidentity
242+
```
243+
232244
```go
233245
tokenCredential, err := azidentity.NewDefaultAzureCredential(nil)
234246

@@ -262,6 +274,8 @@ OpenAIClient client = OpenAIOkHttpClient.builder()
262274

263275
**Microsoft Entra authentication**:
264276

277+
First install the Azure Identity client library. For how to install this library, see [Azure Identity client library for Java](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity/README.md#include-the-package).
278+
265279
```java
266280
Credential tokenCredential = BearerTokenCredential.create(
267281
AuthenticationUtil.getBearerTokenSupplier(
@@ -373,7 +387,6 @@ ChatClient client = new(
373387
model: "grok-3-mini",
374388
credential: new ApiKeyCredential(keyFromEnvironment),
375389
options: new OpenAIClientOptions() {
376-
377390
Endpoint = new Uri("https://YOUR-RESOURCE-NAME.openai.azure.com/openai/v1/")
378391
}
379392
);
@@ -386,7 +399,7 @@ Console.WriteLine($"[ASSISTANT]: {completion.Content[0].Text}");
386399

387400
**Microsoft Entra authentication**:
388401

389-
A secure, keyless authentication approach is to use Microsoft Entra ID (formerly Azure Active Directory) via the [Azure Identity library](/dotnet/api/overview/azure/identity-readme?view=azure-dotnet&preserve-view=true ). To use the library:
402+
A secure, keyless authentication approach is to use Microsoft Entra ID via the [Azure Identity library](/dotnet/api/overview/azure/identity-readme?view=azure-dotnet&preserve-view=true ). To use the library:
390403

391404
```dotnetcli
392405
dotnet add package Azure.Identity
@@ -410,7 +423,6 @@ ChatClient client = new(
410423
model: "grok-3-mini", // Replace with your model deployment name.
411424
authenticationPolicy: tokenPolicy,
412425
options: new OpenAIClientOptions() {
413-
414426
Endpoint = new Uri("https://YOUR-RESOURCE-NAME.openai.azure.com/openai/v1")
415427
}
416428
);
@@ -611,9 +623,9 @@ Add the Azure Identity package:
611623
</dependency>
612624
```
613625

614-
After setup, you can choose which type of credential from `azure.identity` to use. As an example, `DefaultAzureCredential` can be used to authenticate the client: Set the values of the client ID, tenant ID, and client secret of the Microsoft Entra ID application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET.
626+
After setup, you can choose which type of credential from `azure.identity` to use. As an example, `DefaultAzureCredential` can be used to authenticate the client.
615627

616-
Authorization is easiest using `DefaultAzureCredential`. It finds the best credential to use in its running environment. However, use of `DefaultAzureCredential` is only recommended for testing, not for production.
628+
Authentication is easiest using `DefaultAzureCredential`. It finds the best credential to use in its running environment.
617629

618630
```java
619631
Credential tokenCredential = BearerTokenCredential.create(

0 commit comments

Comments
 (0)