Skip to content

Commit e2023ec

Browse files
[translation] update docs to include managed identity option (#22366)
* update dt docs to include managed identity option * fix readme formatting * remove word * fix typo
1 parent 79b0dbb commit e2023ec

File tree

4 files changed

+56
-36
lines changed

4 files changed

+56
-36
lines changed

sdk/translation/azure-ai-translation-document/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,14 @@ document_translation_client = DocumentTranslationClient(
120120
## Key concepts
121121

122122
The Document Translation service requires that you upload your files to an Azure Blob Storage source container and provide
123-
a target container where the translated documents can be written. SAS tokens to the containers (or files) are used to
124-
access the documents and create the translated documents in the target container. Additional information about setting this up can be found in
123+
a target container where the translated documents can be written. Additional information about setting this up can be found in
125124
the service documentation:
126125

127126
- [Set up Azure Blob Storage containers][source_containers] with your documents
128127
- Optionally apply [glossaries][glossary] or a [custom model for translation][custom_model]
129-
- Generate [SAS tokens][sas_token] to your containers (or files) with the appropriate [permissions][sas_token_permissions]
130-
128+
- Allow access to your storage account with either of the following options:
129+
- Generate [SAS tokens][sas_token] to your containers (or files) with the appropriate [permissions][sas_token_permissions]
130+
- Create and use a [managed identity][managed_identity] to grant access to your storage account
131131

132132
### DocumentTranslationClient
133133

@@ -456,7 +456,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con
456456
[custom_subdomain]: https://docs.microsoft.com/azure/cognitive-services/authentication#create-a-resource-with-a-custom-subdomain
457457
[azure_identity]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity
458458
[default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential
459-
459+
[managed_identity]: https://aka.ms/azsdk/documenttranslation/managed-identity
460460
[sdk_logging_docs]: https://docs.microsoft.com/azure/developer/python/azure-sdk-logging
461461

462462
[sample_authentication]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/translation/azure-ai-translation-document/samples/sample_authentication.py

sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_client.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,16 @@ def begin_translation(
125125
For supported languages and document formats, see the service documentation:
126126
https://docs.microsoft.com/azure/cognitive-services/translator/document-translation/overview
127127
128-
:param str source_url: The source SAS URL to the Azure Blob container containing the documents
129-
to be translated. See the service documentation for the supported SAS permissions for accessing
130-
source storage containers/blobs: https://aka.ms/azsdk/documenttranslation/sas-permissions
131-
:param str target_url: The target SAS URL to the Azure Blob container where the translated documents
132-
should be written. See the service documentation for the supported SAS permissions for accessing
133-
target storage containers/blobs: https://aka.ms/azsdk/documenttranslation/sas-permissions
128+
:param str source_url: The source URL to the Azure Blob container containing the documents to be translated.
129+
This can be a SAS URL (see the service documentation for the supported SAS permissions for accessing
130+
source storage containers/blobs: https://aka.ms/azsdk/documenttranslation/sas-permissions) or a managed
131+
identity can be created and used to access documents in your storage account
132+
(see https://aka.ms/azsdk/documenttranslation/managed-identity).
133+
:param str target_url: The target URL to the Azure Blob container where the translated documents
134+
should be written. This can be a SAS URL (see the service documentation for the supported SAS permissions
135+
for accessing target storage containers/blobs: https://aka.ms/azsdk/documenttranslation/sas-permissions)
136+
or a managed identity can be created and used to access documents in your storage account
137+
(see https://aka.ms/azsdk/documenttranslation/managed-identity).
134138
:param str target_language_code: This is the language you want your documents to be translated to.
135139
See supported language codes here:
136140
https://docs.microsoft.com/azure/cognitive-services/translator/language-support#translate

sdk/translation/azure-ai-translation-document/azure/ai/translation/document/_models.py

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,13 @@ def convert_status(status, ll=False):
3232
class TranslationGlossary(object): # pylint: disable=useless-object-inheritance
3333
"""Glossary / translation memory to apply to the translation.
3434
35-
:param str glossary_url: Required. Location of the glossary file. This should be a SAS URL to
36-
the glossary file in the storage blob container. If the translation language pair is
37-
not present in the glossary, it will not be applied. See the service documentation for the
38-
supported SAS permissions: https://aka.ms/azsdk/documenttranslation/sas-permissions
35+
:param str glossary_url: Required. Location of the glossary file. This should be a URL to
36+
the glossary file in the storage blob container. The URL can be a SAS URL (see the
37+
service documentation for the supported SAS permissions for accessing storage
38+
containers/blobs: https://aka.ms/azsdk/documenttranslation/sas-permissions) or a managed identity
39+
can be created and used to access documents in your storage account
40+
(see https://aka.ms/azsdk/documenttranslation/managed-identity). Note that if the translation
41+
language pair is not present in the glossary, it will not be applied.
3942
:param str file_format: Required. Format of the glossary file. To see supported formats,
4043
call the :func:`~DocumentTranslationClient.get_supported_glossary_formats()` client method.
4144
:keyword str format_version: File format version. If not specified, the service will
@@ -44,10 +47,13 @@ class TranslationGlossary(object): # pylint: disable=useless-object-inheritance
4447
:keyword str storage_source: Storage Source. Default value: "AzureBlob".
4548
Currently only "AzureBlob" is supported.
4649
47-
:ivar str glossary_url: Required. Location of the glossary file. This should be a SAS URL to
48-
the glossary file in the storage blob container. If the translation language pair is
49-
not present in the glossary, it will not be applied. See the service documentation for the
50-
supported SAS permissions: https://aka.ms/azsdk/documenttranslation/sas-permissions
50+
:ivar str glossary_url: Required. Location of the glossary file. This should be a URL to
51+
the glossary file in the storage blob container. The URL can be a SAS URL (see the
52+
service documentation for the supported SAS permissions for accessing storage
53+
containers/blobs: https://aka.ms/azsdk/documenttranslation/sas-permissions) or a managed identity
54+
can be created and used to access documents in your storage account
55+
(see https://aka.ms/azsdk/documenttranslation/managed-identity). Note that if the translation
56+
language pair is not present in the glossary, it will not be applied.
5157
:ivar str file_format: Required. Format of the glossary file. To see supported formats,
5258
call the :func:`~DocumentTranslationClient.get_supported_glossary_formats()` client method.
5359
:ivar str format_version: File format version. If not specified, the service will
@@ -95,9 +101,10 @@ class TranslationTarget(object): # pylint: disable=useless-object-inheritance
95101
"""Destination for the finished translated documents.
96102
97103
:param str target_url: Required. The target location for your translated documents.
98-
This should be a container SAS URL to your target container/blob. See the service
99-
documentation for the supported SAS permissions for accessing
100-
target storage containers/blobs: https://aka.ms/azsdk/documenttranslation/sas-permissions
104+
This can be a SAS URL (see the service documentation for the supported SAS permissions
105+
for accessing target storage containers/blobs: https://aka.ms/azsdk/documenttranslation/sas-permissions)
106+
or a managed identity can be created and used to access documents in your storage account
107+
(see https://aka.ms/azsdk/documenttranslation/managed-identity).
101108
:param str language_code: Required. Target Language Code. This is the language
102109
you want your documents to be translated to. See supported languages here:
103110
https://docs.microsoft.com/azure/cognitive-services/translator/language-support#translate
@@ -108,9 +115,10 @@ class TranslationTarget(object): # pylint: disable=useless-object-inheritance
108115
Currently only "AzureBlob" is supported.
109116
110117
:ivar str target_url: Required. The target location for your translated documents.
111-
This should be a container SAS URL to your target container/blob. See the service
112-
documentation for the supported SAS permissions for accessing
113-
target storage containers/blobs: https://aka.ms/azsdk/documenttranslation/sas-permissions
118+
This can be a SAS URL (see the service documentation for the supported SAS permissions
119+
for accessing target storage containers/blobs: https://aka.ms/azsdk/documenttranslation/sas-permissions)
120+
or a managed identity can be created and used to access documents in your storage account
121+
(see https://aka.ms/azsdk/documenttranslation/managed-identity).
114122
:ivar str language_code: Required. Target Language Code. This is the language
115123
you want your documents to be translated to. See supported languages here:
116124
https://docs.microsoft.com/azure/cognitive-services/translator/language-support#translate
@@ -165,13 +173,15 @@ def __repr__(self):
165173
class DocumentTranslationInput(object): # pylint: disable=useless-object-inheritance
166174
# pylint: disable=C0301
167175
"""Input for translation. This requires that you have your source document or
168-
documents in an Azure Blob Storage container. Provide a SAS URL to the source file or
176+
documents in an Azure Blob Storage container. Provide a URL to the source file or
169177
source container containing the documents for translation. The source document(s) are
170178
translated and written to the location provided by the TranslationTargets.
171179
172180
:param str source_url: Required. Location of the folder / container or single file with your
173-
documents. See the service documentation for the supported SAS permissions for accessing
174-
source storage containers/blobs: https://aka.ms/azsdk/documenttranslation/sas-permissions
181+
documents. This can be a SAS URL (see the service documentation for the supported SAS permissions
182+
for accessing source storage containers/blobs: https://aka.ms/azsdk/documenttranslation/sas-permissions)
183+
or a managed identity can be created and used to access documents in your storage account
184+
(see https://aka.ms/azsdk/documenttranslation/managed-identity).
175185
:param targets: Required. Location of the destination for the output. This is a list of
176186
TranslationTargets. Note that a TranslationTarget is required for each language code specified.
177187
:type targets: list[~azure.ai.translation.document.TranslationTarget]
@@ -189,8 +199,10 @@ class DocumentTranslationInput(object): # pylint: disable=useless-object-inheri
189199
Currently only "AzureBlob" is supported.
190200
191201
:ivar str source_url: Required. Location of the folder / container or single file with your
192-
documents. See the service documentation for the supported SAS permissions for accessing
193-
source storage containers/blobs: https://aka.ms/azsdk/documenttranslation/sas-permissions
202+
documents. This can be a SAS URL (see the service documentation for the supported SAS permissions
203+
for accessing source storage containers/blobs: https://aka.ms/azsdk/documenttranslation/sas-permissions)
204+
or a managed identity can be created and used to access documents in your storage account
205+
(see https://aka.ms/azsdk/documenttranslation/managed-identity).
194206
:ivar targets: Required. Location of the destination for the output. This is a list of
195207
TranslationTargets. Note that a TranslationTarget is required for each language code specified.
196208
:vartype targets: list[~azure.ai.translation.document.TranslationTarget]

sdk/translation/azure-ai-translation-document/azure/ai/translation/document/aio/_client_async.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,16 @@ async def begin_translation(
134134
For supported languages and document formats, see the service documentation:
135135
https://docs.microsoft.com/azure/cognitive-services/translator/document-translation/overview
136136
137-
:param str source_url: The source SAS URL to the Azure Blob container containing the documents
138-
to be translated. See the service documentation for the supported SAS permissions for accessing
139-
source storage containers/blobs: https://aka.ms/azsdk/documenttranslation/sas-permissions
140-
:param str target_url: The target SAS URL to the Azure Blob container where the translated documents
141-
should be written. See the service documentation for the supported SAS permissions for accessing
142-
target storage containers/blobs: https://aka.ms/azsdk/documenttranslation/sas-permissions
137+
:param str source_url: The source URL to the Azure Blob container containing the documents to be translated.
138+
This can be a SAS URL (see the service documentation for the supported SAS permissions for accessing
139+
source storage containers/blobs: https://aka.ms/azsdk/documenttranslation/sas-permissions) or a managed
140+
identity can be created and used to access documents in your storage account
141+
(see https://aka.ms/azsdk/documenttranslation/managed-identity).
142+
:param str target_url: The target URL to the Azure Blob container where the translated documents
143+
should be written. This can be a SAS URL (see the service documentation for the supported SAS permissions
144+
for accessing target storage containers/blobs: https://aka.ms/azsdk/documenttranslation/sas-permissions)
145+
or a managed identity can be created and used to access documents in your storage account
146+
(see https://aka.ms/azsdk/documenttranslation/managed-identity).
143147
:param str target_language_code: This is the language you want your documents to be translated to.
144148
See supported language codes here:
145149
https://docs.microsoft.com/azure/cognitive-services/translator/language-support#translate

0 commit comments

Comments
 (0)