Skip to content

Commit d88fd8c

Browse files
committed
SFI 299863
1 parent f14f16c commit d88fd8c

File tree

1 file changed

+21
-68
lines changed

1 file changed

+21
-68
lines changed

articles/ai-services/speech-service/how-to-configure-azure-ad-auth.md

Lines changed: 21 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
title: How to configure Microsoft Entra authentication
33
titleSuffix: Azure AI services
44
description: Learn how to authenticate using Microsoft Entra authentication
5-
author: rhurey
5+
author: eric-urban
66
manager: nitinme
77
ms.service: azure-ai-speech
88
ms.topic: how-to
9-
ms.date: 1/18/2024
10-
ms.author: rhurey
9+
ms.date: 9/9/2024
10+
ms.author: eur
1111
zone_pivot_groups: programming-languages-set-two
12-
ms.devlang: cpp
1312
ms.custom: devx-track-azurepowershell, devx-track-extended-java, devx-track-python, devx-track-azurecli
1413
---
1514

@@ -186,10 +185,10 @@ For ```SpeechRecognizer```, ```SpeechSynthesizer```, ```IntentRecognizer```, ```
186185
::: zone pivot="programming-language-csharp"
187186
```C#
188187
string resourceId = "Your Resource ID";
189-
string aadToken = "Your Azure AD access token";
188+
string aadToken = "Your Microsoft Entra access token";
190189
string region = "Your Speech Region";
191190

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.
193192
var authorizationToken = $"aad#{resourceId}#{aadToken}";
194193
var speechConfig = SpeechConfig.FromAuthorizationToken(authorizationToken, region);
195194
```
@@ -198,10 +197,10 @@ var speechConfig = SpeechConfig.FromAuthorizationToken(authorizationToken, regio
198197
::: zone pivot="programming-language-cpp"
199198
```C++
200199
std::string resourceId = "Your Resource ID";
201-
std::string aadToken = "Your Azure AD access token";
200+
std::string aadToken = "Your Microsoft Entra access token";
202201
std::string region = "Your Speech Region";
203202

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.
205204
auto authorizationToken = "aad#" + resourceId + "#" + aadToken;
206205
auto speechConfig = SpeechConfig::FromAuthorizationToken(authorizationToken, region);
207206
```
@@ -212,7 +211,7 @@ auto speechConfig = SpeechConfig::FromAuthorizationToken(authorizationToken, reg
212211
String resourceId = "Your Resource ID";
213212
String region = "Your Region";
214213

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.
216215
String authorizationToken = "aad#" + resourceId + "#" + token;
217216
SpeechConfig speechConfig = SpeechConfig.fromAuthorizationToken(authorizationToken, region);
218217
```
@@ -222,7 +221,7 @@ SpeechConfig speechConfig = SpeechConfig.fromAuthorizationToken(authorizationTok
222221
```Python
223222
resourceId = "Your Resource ID"
224223
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.
226225
authorizationToken = "aad#" + resourceId + "#" + aadToken.token
227226
speechConfig = SpeechConfig(auth_token=authorizationToken, region=region)
228227
```
@@ -235,10 +234,10 @@ For the ```TranslationRecognizer```, build the authorization token from the reso
235234
::: zone pivot="programming-language-csharp"
236235
```C#
237236
string resourceId = "Your Resource ID";
238-
string aadToken = "Your Azure AD access token";
237+
string aadToken = "Your Microsoft Entra access token";
239238
string region = "Your Speech Region";
240239

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.
242241
var authorizationToken = $"aad#{resourceId}#{aadToken}";
243242
var speechConfig = SpeechTranslationConfig.FromAuthorizationToken(authorizationToken, region);
244243
```
@@ -247,10 +246,10 @@ var speechConfig = SpeechTranslationConfig.FromAuthorizationToken(authorizationT
247246
::: zone pivot="programming-language-cpp"
248247
```cpp
249248
std::string resourceId = "Your Resource ID";
250-
std::string aadToken = "Your Azure AD access token";
249+
std::string aadToken = "Your Microsoft Entra access token";
251250
std::string region = "Your Speech Region";
252251

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.
254253
auto authorizationToken = "aad#" + resourceId + "#" + aadToken;
255254
auto speechConfig = SpeechTranslationConfig::FromAuthorizationToken(authorizationToken, region);
256255
```
@@ -261,7 +260,7 @@ auto speechConfig = SpeechTranslationConfig::FromAuthorizationToken(authorizatio
261260
String resourceId = "Your Resource ID";
262261
String region = "Your Region";
263262

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.
265264
String authorizationToken = "aad#" + resourceId + "#" + token;
266265
SpeechTranslationConfig translationConfig = SpeechTranslationConfig.fromAuthorizationToken(authorizationToken, region);
267266
```
@@ -272,70 +271,24 @@ SpeechTranslationConfig translationConfig = SpeechTranslationConfig.fromAuthoriz
272271
resourceId = "Your Resource ID"
273272
region = "Your Region"
274273

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.
276275
authorizationToken = "aad#" + resourceId + "#" + aadToken.token
277276
translationConfig = SpeechTranslationConfig(auth_token=authorizationToken, region=region)
278277
```
279278
::: zone-end
280279

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-
327280
### VoiceProfileClient
328281
To use the ```VoiceProfileClient``` with Microsoft Entra authentication, use the custom domain name created above.
329282

330283
::: zone pivot="programming-language-csharp"
331284
```C#
332285
string customDomainName = "Your Custom Name";
333286
string hostName = $"https://{customDomainName}.cognitiveservices.azure.com/";
334-
string token = "Your Azure AD access token";
287+
string token = "Your Microsoft Entra access token";
335288

336289
var config = SpeechConfig.FromHost(new Uri(hostName));
337290

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.
339292
var authorizationToken = $"aad#{resourceId}#{aadToken}";
340293
config.AuthorizationToken = authorizationToken;
341294
```
@@ -344,24 +297,24 @@ config.AuthorizationToken = authorizationToken;
344297
::: zone pivot="programming-language-cpp"
345298
```cpp
346299
std::string customDomainName = "Your Custom Name";
347-
std::string aadToken = "Your Azure AD access token";
300+
std::string aadToken = "Your Microsoft Entra access token";
348301

349302
auto speechConfig = SpeechConfig::FromHost("https://" + customDomainName + ".cognitiveservices.azure.com/");
350303

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.
352305
auto authorizationToken = "aad#" + resourceId + "#" + aadToken;
353306
speechConfig->SetAuthorizationToken(authorizationToken);
354307
```
355308
::: zone-end
356309
357310
::: zone pivot="programming-language-java"
358311
```Java
359-
String aadToken = "Your Azure AD access token";
312+
String aadToken = "Your Microsoft Entra access token";
360313
String customDomainName = "Your Custom Name";
361314
String hostName = "https://" + customDomainName + ".cognitiveservices.azure.com/";
362315
SpeechConfig speechConfig = SpeechConfig.fromHost(new URI(hostName));
363316
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.
365318
String authorizationToken = "aad#" + resourceId + "#" + token;
366319
367320
speechConfig.setAuthorizationToken(authorizationToken);

0 commit comments

Comments
 (0)