You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/cognitive-services/Translator/document-translation/get-started-with-document-translation.md
+35-14Lines changed: 35 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,17 +22,39 @@ ms.custom: mode-other
22
22
23
23
> [!NOTE]
24
24
>
25
-
> 1. Generally, when you create a Cognitive Service resource in the Azure portal, you have the option to create a multi-service subscription key or a single-service subscription key. However, Document Translation is currently supported in the Translator (single-service) resource only, and is **not** included in the Cognitive Services (multi-service) resource.
26
-
> 2. Document Translation is **only** available in the S1 Standard Service Plan (Pay-as-you-go) or in the D3 Volume Discount Plan. _See_[Cognitive Services pricing—Translator](https://azure.microsoft.com/pricing/details/cognitive-services/translator/).
25
+
> * Generally, when you create a Cognitive Service resource in the Azure portal, you have the option to create a multi-service subscription key or a single-service subscription key. However, Document Translation is currently supported in the Translator (single-service) resource only, and is **not** included in the Cognitive Services (multi-service) resource.
26
+
>
27
+
> * Document Translation is **only** supported in the S1 Standard Service Plan (Pay-as-you-go) or in the D3 Volume Discount Plan. _See_[Cognitive Services pricing—Translator](https://azure.microsoft.com/pricing/details/cognitive-services/translator/).
27
28
>
28
29
29
30
To get started, you'll need:
30
31
31
32
* An active [**Azure account**](https://azure.microsoft.com/free/cognitive-services/). If you don't have one, you can [**create a free account**](https://azure.microsoft.com/free/).
32
33
33
-
* A [**single-service Translator resource**](https://portal.azure.com/#create/Microsoft.CognitiveServicesTextTranslation) (**not** a multi-service Cognitive Services resource).
34
+
* An [**Azure blob storage account**](https://portal.azure.com/#create/Microsoft.StorageAccount-ARM). You'll create containers to store and organize your blob data within your storage account.
35
+
36
+
* A [**single-service Translator resource**](https://portal.azure.com/#create/Microsoft.CognitiveServicesTextTranslation) (**not** a multi-service Cognitive Services resource):
37
+
38
+
**Complete the Translator project and instance details fields as follows:**
39
+
40
+
1.**Subscription**. Select one of your available Azure subscriptions.
41
+
42
+
1.**Resource Group**. You can create a new resource group or add your resource to a pre-existing resource group that shares the same lifecycle, permissions, and policies.
43
+
44
+
1.**Resource Region**. Choose **Global** unless your business or application requires a specific region. If you're planning on using a [system-assigned managed identity](managed-identity.md) for authentication, choose a **non-global** region.
34
45
35
-
* An [**Azure blob storage account**](https://portal.azure.com/#create/Microsoft.StorageAccount-ARM). You will create containers to store and organize your blob data within your storage account.
46
+
1.**Name**. Enter the name you have chosen for your resource. The name you choose must be unique within Azure.
47
+
48
+
> [!NOTE]
49
+
> Document Translation requires a custom domain endpoint. The value that you enter in the Name field will be the custom domain name parameter for your endpoint.
50
+
51
+
1.**Pricing tier**. Document Translation isn't supported in the free tier. Select Standard S1 to try the service.
52
+
53
+
1. Select **Review + Create**.
54
+
55
+
1. Review the service terms and select **Create** to deploy your resource.
56
+
57
+
1. After your resource has successfully deployed, select **Go to resource**.
36
58
37
59
## Custom domain name and subscription key
38
60
@@ -88,11 +110,11 @@ The `sourceUrl` , `targetUrl` , and optional `glossaryUrl` must include a Share
88
110
>
89
111
> * If you're translating **multiple** files (blobs) in an operation, **delegate SAS access at the container level**.
90
112
> * If you're translating a **single** file (blob) in an operation, **delegate SAS access at the blob level**.
91
-
>
113
+
>* As an alternative to SAS tokens, you can use a [**system-assigned managed identity**](managed-identity.md) for authentication.
92
114
93
-
## Document Translation: HTTP requests
115
+
## HTTP requests
94
116
95
-
A batch Document Translation request is submitted to your Translator service endpoint via a POST request. If successful, the POST method returns a `202 Accepted` response code and the batch request is created by the service.
117
+
A batch Document Translation request is submitted to your Translator service endpoint via a POST request. If successful, the POST method returns a `202 Accepted` response code and the batch request is created by the service. The translated documents will be listed in your target container.
96
118
97
119
### HTTP headers
98
120
@@ -102,7 +124,6 @@ The following headers are included with each Document Translator API request:
102
124
|---|--|
103
125
|Ocp-Apim-Subscription-Key|**Required**: The value is the Azure subscription key for your Translator or Cognitive Services resource.|
104
126
|Content-Type|**Required**: Specifies the content type of the payload. Accepted values are application/json or charset=UTF-8.|
105
-
|Content-Length|**Required**: the length of the request body.|
106
127
107
128
### POST request body properties
108
129
@@ -139,9 +160,9 @@ The following headers are included with each Document Translator API request:
139
160
140
161
### Translate a specific document in a container
141
162
142
-
*Ensure you have specified "storageType": "File"
143
-
*Ensure you have created source URL & SAS token for the specific blob/document (not for the container)
144
-
* Ensure you have specified the target filename as part of the target URL – though the SAS token is still for the container.
163
+
*Specify `"storageType": "File"`
164
+
*If you aren't using a [**system-assigned managed identity**](managed-identity.md) for authentication, make sure you've created source URL & SAS token for the specific blob/document (not for the container)
165
+
* Ensure you've specified the target filename as part of the target URL – though the SAS token is still for the container.
145
166
* Sample request below shows a single document getting translated into two target languages
146
167
147
168
```json
@@ -1274,7 +1295,7 @@ The table below lists the limits for data that you send to Document Translation.
|400|BadRequest|Arequiredparameterismissing, empty, or null. Or, the value passed to either a required or optional parameter is invalid. A common issue is a header that is too long. |
1287
-
| 401 | Unauthorized | The request is not authorized. Check to make sure your subscription key or token is valid and in the correct region. When managing your subscription on the Azureportal, pleaseensureyou'reusingthe **Translator** single-serviceresource_not_the **CognitiveServices** multi-serviceresource.
| 401 | Unauthorized | The request isn't authorized. Check to make sure your subscription key or token is valid and in the correct region. When managing your subscription on the Azureportal, makesureyou'reusingthe **Translator** single-serviceresource_not_the **CognitiveServices** multi-serviceresource.
> Managed identities for Azure resources are currently unavailable for Document Translation service in the global region. If you intend to use managed identities for Document Translation operations, [create your Translator resource](https://portal.azure.com/#create/Microsoft.CognitiveServicesTextTranslation) in a non-global Azure region.
18
+
> * Currently, Document Translation doesn't support managed identity in the global region. If you intend to use managed identities for Document Translation operations, [create your Translator resource](https://portal.azure.com/#create/Microsoft.CognitiveServicesTextTranslation) in a non-global Azure region.
19
+
>
20
+
> * Document Translation is **only** available in the S1 Standard Service Plan (Pay-as-you-go) or in the D3 Volume Discount Plan. _See_[Cognitive Services pricing—Translator](https://azure.microsoft.com/pricing/details/cognitive-services/translator/).
21
+
>
19
22
20
23
Managed identities for Azure resources are service principals that create an Azure Active Directory (Azure AD) identity and specific permissions for Azure managed resources:
21
24
22
-
* You can use managed identities to grant access to any resource that supports Azure AD authentication, including your own applications. Unlike security keys and authentication tokens, managed identities eliminate the need for developers to manage credentials.
25
+
* You can use managed identities to grant access to any resource that supports Azure AD authentication, including your own applications. Managed identities eliminate the need for you to include shared access signature tokens (SAS) with your HTTP requests.
23
26
24
-
* To grant access to an Azure resource, assign an Azure role to a managed identity using [Azure role-based access control (Azure RBAC)](../../../role-based-access-control/overview.md).
27
+
* To grant access to an Azure resource, you'll assign an Azure role to a managed identity using [Azure role-based access control (Azure RBAC)](../../../role-based-access-control/overview.md).
25
28
26
29
* There's no added cost to use managed identities in Azure.
27
30
28
31
> [!TIP]
29
-
> Managed identities eliminate the need for you to manage credentials, including Shared Access Signature (SAS) tokens. Managed identities are a safer way to grant access to data without having credentials in your code.
32
+
>
33
+
> * When using managed identities, don't include a SAS token URL with your HTTP requests—your requests will fail.
34
+
>
35
+
> * Managed identities are a safer way to grant access to data without having SAS tokens included with your HTTP requests.
30
36
31
-
## Prerequisites
32
37
38
+
## Prerequisites
33
39
To get started, you'll need:
34
40
35
41
* An active [**Azure account**](https://azure.microsoft.com/free/cognitive-services/)—if you don't have one, you can [**create a free account**](https://azure.microsoft.com/free/).
@@ -38,7 +44,7 @@ To get started, you'll need:
38
44
39
45
* A brief understanding of [**Azure role-based access control (Azure RBAC)**](../../../role-based-access-control/role-assignments-portal.md) using the Azure portal.
40
46
41
-
* An [**Azure blob storage account**](https://portal.azure.com/#create/Microsoft.StorageAccount-ARM) in the same region as your Translator resource. You'll create containers to store and organize your blob data within your storage account.
47
+
* An [**Azure blob storage account**](https://portal.azure.com/#create/Microsoft.StorageAccount-ARM) in the same region as your Translator resource. You'll create containers to store and organize your blob data within your storage account.
42
48
43
49
***If your storage account is behind a firewall, you must enable the following configuration**: </br>
44
50
@@ -54,9 +60,9 @@ To get started, you'll need:
54
60
55
61
## Managed identity assignments
56
62
57
-
There are two types of managed identities: **system-assigned** and **user-assigned**. Currently, Document Translation supports system-assigned managed identities:
63
+
There are two types of managed identities: **system-assigned** and **user-assigned**. Currently, Document Translation supports **system-assigned managed identity**:
58
64
59
-
* A system-assigned managed identity is **enabled** directly on a service instance. It isn't enabled by default; you must go to your resource and update the identity setting.
65
+
* A system-assigned managed identity is **enabled** directly on a service instance. It isn't enabled by default; you must go to your resource and update the identity setting.
60
66
61
67
* The system-assigned managed identity is tied to your resource throughout its lifecycle. If you delete your resource, the managed identity will be deleted as well.
62
68
@@ -80,7 +86,7 @@ In the following steps, we'll enable a system-assigned managed identity and gran
80
86
81
87
## Grant access to your storage account
82
88
83
-
You need to grant Translator access to your storage account before it can create, read, or delete blobs. Now that you enabled Translator with a system-assigned managed identity, you can use Azure role-based access control (Azure RBAC), to give Translator access to Azure storage.
89
+
You need to grant Translator access to your storage account before it can create, read, or delete blobs. Once you've enabled Translator with a system-assigned managed identity, you can use Azure role-based access control (Azure RBAC), to give Translator access to your Azure storage containers.
84
90
85
91
The **Storage Blob Data Contributor** role gives Translator (represented by the system-assigned managed identity) read, write, and delete access to the blob container and data.
86
92
@@ -115,9 +121,126 @@ The **Storage Blob Data Contributor** role gives Translator (represented by the
115
121
116
122
:::image type="content" source="../media/managed-identities/assigned-roles-window.png" alt-text="Screenshot: Azure role assignments window.":::
117
123
118
-
Great! You've completed the steps to enable a system-assigned managed identity. With managed identity and Azure RBAC, you granted Translator specific access rights to your storage resource without having to manage credentials such as SAS tokens.
124
+
## HTTP requests
125
+
126
+
* A batch Document Translation request is submitted to your Translator service endpoint via a POST request.
127
+
128
+
* With managed identity and Azure RBAC, you'll no longer need to include SAS URLs.
129
+
130
+
* If successful, the POST method returns a `202 Accepted` response code and the batch request is created by the service.
131
+
132
+
* The translated documents will appear in your target container.
133
+
134
+
### Headers
135
+
136
+
The following headers are included with each Document Translator API request:
137
+
138
+
|HTTP header|Description|
139
+
|---|--|
140
+
|Ocp-Apim-Subscription-Key|**Required**: The value is the Azure subscription key for your Translator or Cognitive Services resource.|
141
+
|Content-Type|**Required**: Specifies the content type of the payload. Accepted values are application/json or charset=UTF-8.|
142
+
143
+
### POST request body
144
+
145
+
* The request URL is POST `https://<NAME-OF-YOUR-RESOURCE>.cognitiveservices.azure.com/translator/text/batch/v1.0/batches`
146
+
147
+
* The request body is a JSON object named `inputs`.
148
+
* The `inputs` object contains both `sourceURL` and `targetURL` container addresses for your source and target language pairs
149
+
* The `prefix` and `suffix` fields (optional) are used to filter documents in the container including folders.
150
+
* A value for the `glossaries` field (optional) is applied when the document is being translated.
151
+
* The `targetUrl` for each target language must be unique.
152
+
153
+
>[!NOTE]
154
+
> If a file with the same name already exists in the destination, the job will fail.
Great! You've learned how to enable and use a system-assigned managed identity. With managed identity for Azure Resources and Azure RBAC, you granted Translator specific access rights to your storage resource without including SAS tokens with your HTTP requests.
119
235
120
236
## Next steps
121
237
238
+
**Quickstart**
239
+
240
+
> [!div class="nextstepaction"]
241
+
> [Get started with Document Translation](get-started-with-document-translation.md)
242
+
243
+
**Tutorial**
244
+
122
245
> [!div class="nextstepaction"]
123
246
> [Access Azure Storage from a web app using managed identities](/azure/app-service/scenario-secure-app-access-storage?toc=/azure/cognitive-services/translator/toc.json&bc=/azure/cognitive-services/translator/breadcrumb/toc.json)
0 commit comments