2
2
title : How to configure Microsoft Entra authentication
3
3
titleSuffix : Azure AI services
4
4
description : Learn how to authenticate using Microsoft Entra authentication
5
- author : rhurey
5
+ author : eric-urban
6
6
manager : nitinme
7
7
ms.service : azure-ai-speech
8
8
ms.topic : how-to
9
- ms.date : 1/18 /2024
10
- ms.author : rhurey
9
+ ms.date : 9/9 /2024
10
+ ms.author : eur
11
11
zone_pivot_groups : programming-languages-set-two
12
- ms.devlang : cpp
13
12
ms.custom : devx-track-azurepowershell, devx-track-extended-java, devx-track-python, devx-track-azurecli
14
13
---
15
14
@@ -186,10 +185,10 @@ For ```SpeechRecognizer```, ```SpeechSynthesizer```, ```IntentRecognizer```, ```
186
185
::: zone pivot="programming-language-csharp"
187
186
``` C#
188
187
string resourceId = " Your Resource ID" ;
189
- string aadToken = " Your Azure AD access token" ;
188
+ string aadToken = " Your Microsoft Entra access token" ;
190
189
string region = " Your Speech Region" ;
191
190
192
- // You need to include the "aad#" prefix and the "#" (hash) separator between resource ID and AAD access token.
191
+ // You need to include the "aad#" prefix and the "#" (hash) separator between resource ID and Microsoft Entra access token.
193
192
var authorizationToken = $" aad#{resourceId }#{aadToken }" ;
194
193
var speechConfig = SpeechConfig .FromAuthorizationToken (authorizationToken , region );
195
194
```
@@ -198,10 +197,10 @@ var speechConfig = SpeechConfig.FromAuthorizationToken(authorizationToken, regio
198
197
::: zone pivot="programming-language-cpp"
199
198
``` C++
200
199
std::string resourceId = " Your Resource ID" ;
201
- std::string aadToken = " Your Azure AD access token" ;
200
+ std::string aadToken = " Your Microsoft Entra access token" ;
202
201
std::string region = " Your Speech Region" ;
203
202
204
- // You need to include the "aad#" prefix and the "#" (hash) separator between resource ID and AAD access token.
203
+ // You need to include the "aad#" prefix and the "#" (hash) separator between resource ID and Microsoft Entra access token.
205
204
auto authorizationToken = " aad#" + resourceId + " #" + aadToken;
206
205
auto speechConfig = SpeechConfig::FromAuthorizationToken(authorizationToken, region);
207
206
```
@@ -212,7 +211,7 @@ auto speechConfig = SpeechConfig::FromAuthorizationToken(authorizationToken, reg
212
211
String resourceId = " Your Resource ID" ;
213
212
String region = " Your Region" ;
214
213
215
- // You need to include the "aad#" prefix and the "#" (hash) separator between resource ID and AAD access token.
214
+ // You need to include the "aad#" prefix and the "#" (hash) separator between resource ID and Microsoft Entra access token.
216
215
String authorizationToken = " aad#" + resourceId + " #" + token;
217
216
SpeechConfig speechConfig = SpeechConfig . fromAuthorizationToken(authorizationToken, region);
218
217
```
@@ -222,7 +221,7 @@ SpeechConfig speechConfig = SpeechConfig.fromAuthorizationToken(authorizationTok
222
221
``` Python
223
222
resourceId = " Your Resource ID"
224
223
region = " Your Region"
225
- # You need to include the "aad#" prefix and the "#" (hash) separator between resource ID and AAD access token.
224
+ # You need to include the "aad#" prefix and the "#" (hash) separator between resource ID and Microsoft Entra access token.
226
225
authorizationToken = " aad#" + resourceId + " #" + aadToken.token
227
226
speechConfig = SpeechConfig(auth_token = authorizationToken, region = region)
228
227
```
@@ -235,10 +234,10 @@ For the ```TranslationRecognizer```, build the authorization token from the reso
235
234
::: zone pivot="programming-language-csharp"
236
235
``` C#
237
236
string resourceId = " Your Resource ID" ;
238
- string aadToken = " Your Azure AD access token" ;
237
+ string aadToken = " Your Microsoft Entra access token" ;
239
238
string region = " Your Speech Region" ;
240
239
241
- // You need to include the "aad#" prefix and the "#" (hash) separator between resource ID and AAD access token.
240
+ // You need to include the "aad#" prefix and the "#" (hash) separator between resource ID and Microsoft Entra access token.
242
241
var authorizationToken = $" aad#{resourceId }#{aadToken }" ;
243
242
var speechConfig = SpeechTranslationConfig .FromAuthorizationToken (authorizationToken , region );
244
243
```
@@ -247,10 +246,10 @@ var speechConfig = SpeechTranslationConfig.FromAuthorizationToken(authorizationT
247
246
::: zone pivot="programming-language-cpp"
248
247
``` cpp
249
248
std::string resourceId = " Your Resource ID" ;
250
- std::string aadToken = " Your Azure AD access token" ;
249
+ std::string aadToken = " Your Microsoft Entra access token" ;
251
250
std::string region = " Your Speech Region" ;
252
251
253
- // You need to include the "aad#" prefix and the "#" (hash) separator between resource ID and AAD access token.
252
+ // You need to include the "aad#" prefix and the "#" (hash) separator between resource ID and Microsoft Entra access token.
254
253
auto authorizationToken = " aad#" + resourceId + " #" + aadToken;
255
254
auto speechConfig = SpeechTranslationConfig::FromAuthorizationToken(authorizationToken, region);
256
255
```
@@ -261,7 +260,7 @@ auto speechConfig = SpeechTranslationConfig::FromAuthorizationToken(authorizatio
261
260
String resourceId = " Your Resource ID" ;
262
261
String region = " Your Region" ;
263
262
264
- // You need to include the "aad#" prefix and the "#" (hash) separator between resource ID and AAD access token.
263
+ // You need to include the "aad#" prefix and the "#" (hash) separator between resource ID and Microsoft Entra access token.
265
264
String authorizationToken = " aad#" + resourceId + " #" + token;
266
265
SpeechTranslationConfig translationConfig = SpeechTranslationConfig . fromAuthorizationToken(authorizationToken, region);
267
266
```
@@ -272,70 +271,24 @@ SpeechTranslationConfig translationConfig = SpeechTranslationConfig.fromAuthoriz
272
271
resourceId = " Your Resource ID"
273
272
region = " Your Region"
274
273
275
- # You need to include the "aad#" prefix and the "#" (hash) separator between resource ID and AAD access token.
274
+ # You need to include the "aad#" prefix and the "#" (hash) separator between resource ID and Microsoft Entra access token.
276
275
authorizationToken = " aad#" + resourceId + " #" + aadToken.token
277
276
translationConfig = SpeechTranslationConfig(auth_token = authorizationToken, region = region)
278
277
```
279
278
::: zone-end
280
279
281
- ### DialogServiceConnector
282
-
283
- For the ``` DialogServiceConnection ``` object, build the authorization token from the resource ID and the Microsoft Entra access token and then use it to create a ``` CustomCommandsConfig ``` or a ``` BotFrameworkConfig ``` object.
284
-
285
- ::: zone pivot="programming-language-csharp"
286
- ``` C#
287
- string resourceId = " Your Resource ID" ;
288
- string aadToken = " Your Azure AD access token" ;
289
- string region = " Your Speech Region" ;
290
- string appId = " Your app ID" ;
291
-
292
- // You need to include the "aad#" prefix and the "#" (hash) separator between resource ID and AAD access token.
293
- var authorizationToken = $" aad#{resourceId }#{aadToken }" ;
294
- var customCommandsConfig = CustomCommandsConfig .FromAuthorizationToken (appId , authorizationToken , region );
295
- ```
296
- ::: zone-end
297
-
298
- ::: zone pivot="programming-language-cpp"
299
- ``` cpp
300
- std::string resourceId = " Your Resource ID" ;
301
- std::string aadToken = " Your Azure AD access token" ;
302
- std::string region = " Your Speech Region" ;
303
- std::string appId = " Your app Id" ;
304
-
305
- // You need to include the "aad#" prefix and the "#" (hash) separator between resource ID and AAD access token.
306
- auto authorizationToken = " aad#" + resourceId + " #" + aadToken;
307
- auto customCommandsConfig = CustomCommandsConfig::FromAuthorizationToken(appId, authorizationToken, region);
308
- ```
309
- ::: zone-end
310
-
311
- ::: zone pivot="programming-language-java"
312
- ``` Java
313
- String resourceId = " Your Resource ID" ;
314
- String region = " Your Region" ;
315
- String appId = " Your AppId" ;
316
-
317
- // You need to include the "aad#" prefix and the "#" (hash) separator between resource ID and AAD access token.
318
- String authorizationToken = " aad#" + resourceId + " #" + token;
319
- CustomCommandsConfig dialogServiceConfig = CustomCommandsConfig . fromAuthorizationToken(appId, authorizationToken, region);
320
- ```
321
- ::: zone-end
322
-
323
- ::: zone pivot="programming-language-python"
324
- The DialogServiceConnector is not currently supported in Python
325
- ::: zone-end
326
-
327
280
### VoiceProfileClient
328
281
To use the ``` VoiceProfileClient ``` with Microsoft Entra authentication, use the custom domain name created above.
329
282
330
283
::: zone pivot="programming-language-csharp"
331
284
``` C#
332
285
string customDomainName = " Your Custom Name" ;
333
286
string hostName = $" https://{customDomainName }.cognitiveservices.azure.com/" ;
334
- string token = " Your Azure AD access token" ;
287
+ string token = " Your Microsoft Entra access token" ;
335
288
336
289
var config = SpeechConfig .FromHost (new Uri (hostName ));
337
290
338
- // You need to include the "aad#" prefix and the "#" (hash) separator between resource ID and AAD access token.
291
+ // You need to include the "aad#" prefix and the "#" (hash) separator between resource ID and Microsoft Entra access token.
339
292
var authorizationToken = $" aad#{resourceId }#{aadToken }" ;
340
293
config .AuthorizationToken = authorizationToken ;
341
294
```
@@ -344,24 +297,24 @@ config.AuthorizationToken = authorizationToken;
344
297
::: zone pivot="programming-language-cpp"
345
298
``` cpp
346
299
std::string customDomainName = " Your Custom Name" ;
347
- std::string aadToken = " Your Azure AD access token" ;
300
+ std::string aadToken = " Your Microsoft Entra access token" ;
348
301
349
302
auto speechConfig = SpeechConfig::FromHost(" https://" + customDomainName + " .cognitiveservices.azure.com/" );
350
303
351
- // You need to include the "aad#" prefix and the "#" (hash) separator between resource ID and AAD access token.
304
+ // You need to include the "aad#" prefix and the "#" (hash) separator between resource ID and Microsoft Entra access token.
352
305
auto authorizationToken = " aad#" + resourceId + " #" + aadToken;
353
306
speechConfig->SetAuthorizationToken (authorizationToken);
354
307
```
355
308
::: zone-end
356
309
357
310
::: zone pivot="programming-language-java"
358
311
```Java
359
- String aadToken = "Your Azure AD access token";
312
+ String aadToken = "Your Microsoft Entra access token";
360
313
String customDomainName = "Your Custom Name";
361
314
String hostName = "https://" + customDomainName + ".cognitiveservices.azure.com/";
362
315
SpeechConfig speechConfig = SpeechConfig.fromHost(new URI(hostName));
363
316
364
- // You need to include the "aad#" prefix and the "#" (hash) separator between resource ID and AAD access token.
317
+ // You need to include the "aad#" prefix and the "#" (hash) separator between resource ID and Microsoft Entra access token.
365
318
String authorizationToken = "aad#" + resourceId + "#" + token;
366
319
367
320
speechConfig.setAuthorizationToken(authorizationToken);
0 commit comments