Skip to content

Commit 6f41964

Browse files
authored
Merge pull request #4122 from eric-urban/eur/fast-transcription-entra
fast transcription ID with entra ID
2 parents acdcb86 + 4e84bf5 commit 6f41964

File tree

2 files changed

+51
-2
lines changed

2 files changed

+51
-2
lines changed

articles/ai-services/speech-service/fast-transcription-create.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ author: eric-urban
77
ms.author: eur
88
ms.service: azure-ai-speech
99
ms.topic: how-to
10-
ms.date: 2/28/2025
10+
ms.date: 4/15/2025
1111
# Customer intent: As a user who implements audio transcription, I want create transcriptions as quickly as possible.
1212
---
1313

@@ -50,6 +50,9 @@ The following example shows how to transcribe an audio file with a specified loc
5050
- Replace `YourServiceRegion` with your Speech resource region.
5151
- Replace `YourAudioFile` with the path to your audio file.
5252

53+
> [!IMPORTANT]
54+
> For the recommended keyless authentication with Microsoft Entra ID, replace `--header 'Ocp-Apim-Subscription-Key: YourSubscriptionKey'` with `--header "Authorization: Bearer YourAccessToken"`. For more information about keyless authentication, see the [role-based access control](./role-based-access-control.md#authentication-with-keys-and-tokens) how-to guide.
55+
5356
```azurecli-interactive
5457
curl --location 'https://YourServiceRegion.api.cognitive.microsoft.com/speechtotext/transcriptions:transcribe?api-version=2024-11-15' \
5558
--header 'Content-Type: multipart/form-data' \
@@ -299,6 +302,9 @@ The following example shows how to transcribe an audio file with language identi
299302
- Replace `YourServiceRegion` with your Speech resource region.
300303
- Replace `YourAudioFile` with the path to your audio file.
301304

305+
> [!IMPORTANT]
306+
> For the recommended keyless authentication with Microsoft Entra ID, replace `--header 'Ocp-Apim-Subscription-Key: YourSubscriptionKey'` with `--header "Authorization: Bearer YourAccessToken"`. For more information about keyless authentication, see the [role-based access control](./role-based-access-control.md#authentication-with-keys-and-tokens) how-to guide.
307+
302308
```azurecli-interactive
303309
curl --location 'https://YourServiceRegion.api.cognitive.microsoft.com/speechtotext/transcriptions:transcribe?api-version=2024-11-15' \
304310
--header 'Content-Type: multipart/form-data' \
@@ -585,6 +591,9 @@ The following example shows how to transcribe an audio file with diarization ena
585591
- Replace `YourServiceRegion` with your Speech resource region.
586592
- Replace `YourAudioFile` with the path to your audio file.
587593

594+
> [!IMPORTANT]
595+
> For the recommended keyless authentication with Microsoft Entra ID, replace `--header 'Ocp-Apim-Subscription-Key: YourSubscriptionKey'` with `--header "Authorization: Bearer YourAccessToken"`. For more information about keyless authentication, see the [role-based access control](./role-based-access-control.md#authentication-with-keys-and-tokens) how-to guide.
596+
588597
```azurecli-interactive
589598
curl --location 'https://YourServiceRegion.api.cognitive.microsoft.com/speechtotext/transcriptions:transcribe?api-version=2024-11-15' \
590599
--header 'Content-Type: multipart/form-data' \
@@ -854,6 +863,9 @@ The following example shows how to transcribe an audio file that has one or two
854863
- Replace `YourServiceRegion` with your Speech resource region.
855864
- Replace `YourAudioFile` with the path to your audio file.
856865

866+
> [!IMPORTANT]
867+
> For the recommended keyless authentication with Microsoft Entra ID, replace `--header 'Ocp-Apim-Subscription-Key: YourSubscriptionKey'` with `--header "Authorization: Bearer YourAccessToken"`. For more information about keyless authentication, see the [role-based access control](./role-based-access-control.md#authentication-with-keys-and-tokens) how-to guide.
868+
857869
```azurecli-interactive
858870
curl --location 'https://YourServiceRegion.api.cognitive.microsoft.com/speechtotext/transcriptions:transcribe?api-version=2024-11-15' \
859871
--header 'Content-Type: multipart/form-data' \

articles/ai-services/speech-service/role-based-access-control.md

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ A role definition is a collection of permissions. When you create an AI Services
3636
|**Cognitive Services Data Reader (Preview)** |No |View only |Yes |
3737

3838
> [!IMPORTANT]
39-
> Whether a role can list resource keys is important for [Speech Studio authentication](#speech-studio-authentication). To list resource keys, a role must have permission to run the `Microsoft.CognitiveServices/accounts/listKeys/action` operation. Please note that if key authentication is disabled in the Azure Portal, then none of the roles can list keys.
39+
> Whether a role can list resource keys is important for [Speech Studio authentication](#speech-studio-authentication). To list resource keys, a role must have permission to run the `Microsoft.CognitiveServices/accounts/listKeys/action` operation. Please note that if key authentication is disabled in the Azure portal, then none of the roles can list keys.
4040
4141
Keep the built-in roles if your Speech resource can have full read and write access to the projects.
4242

@@ -48,6 +48,43 @@ The [roles](#roles-for-speech-resources) define what permissions you have. Authe
4848

4949
To authenticate with Speech resource keys, all you need is the key and region. To authenticate with a Microsoft Entra token, the Speech resource must have a [custom subdomain](speech-services-private-link.md#create-a-custom-domain-name).
5050

51+
Here's how to create a new Azure AI Services resource with a custom subdomain. You can also use an existing resource, but it must have a custom subdomain. For more information about creating a custom subdomain, see [Create a custom domain name](speech-services-private-link.md#create-a-custom-domain-name).
52+
53+
```bash
54+
resourceGroupName=my-speech-rg
55+
location=eastus
56+
AIServicesResourceName=my-aiservices-$location
57+
58+
# create an AIServices resource for Speech and other AI services
59+
az cognitiveservices account create --name $AIServicesResourceName --resource-group $resourceGroupName --kind AIServices --sku S0 --location $location --custom-domain $AIServicesResourceName
60+
61+
# get the resource id
62+
speechResourceId=$(az cognitiveservices account show --name $AIServicesResourceName --resource-group $resourceGroupName --query id -o tsv)
63+
# assign Cognitive Services User role to the app id
64+
appId=$(az ad signed-in-user show --query id -o tsv)
65+
az role assignment create --role "Cognitive Services User" --assignee $appId --scope $speechResourceId
66+
# assign Cognitive Services Speech User role to the app id
67+
az role assignment create --role "Cognitive Services Speech User" --assignee $appId --scope $speechResourceId
68+
69+
# get an access token
70+
accessToken=$(az account get-access-token --scope "https://cognitiveservices.azure.com/.default" --query accessToken -o tsv)
71+
echo $accessToken
72+
```
73+
74+
The returned `accessToken` is a Microsoft Entra token that you can use to authenticate without API keys. The token has a [limited lifetime](/entra/identity-platform/configurable-token-lifetimes#access-tokens).
75+
76+
Now you can use the `accessToken` to authenticate with the AI Services resource. For example, you can use the token via the [Fast transcription REST API](./fast-transcription-create.md):
77+
78+
```bash
79+
uri="https://$AIServicesResourceName.cognitiveservices.azure.com/speechtotext/transcriptions:transcribe?api-version=2024-11-15"
80+
81+
curl -v "$uri" \
82+
--header 'Content-Type: multipart/form-data' \
83+
--form 'definition={"locales": ["en-US"]}' \
84+
--form 'audio=@Call1_separated_16k_health_insurance.wav' \
85+
--header "Authorization: Bearer $accessToken"
86+
```
87+
5188
### Speech SDK authentication
5289

5390
For the SDK, you configure whether to authenticate with an API key or Microsoft Entra token. For details, see [Microsoft Entra authentication with the Speech SDK](how-to-configure-azure-ad-auth.md).

0 commit comments

Comments
 (0)