I encountered the same error when using the C# SDK.
"Cannot access source document location with the current permissions."
Here is the code:
DocumentTranslationClient client = new(new Uri("<Endpoint>"}), new AzureKeyCredential("<Key>"));
DocumentTranslationInput input = new DocumentTranslationInput(
new Uri("https://xxx.blob.core.windows.net/translator-source/testfile.pdf?<SAS>"),
new Uri("https://xxx.blob.core.windows.net/translator-target/testfile.en.pdf?<SAS>"),
"en");
DocumentTranslationOperation operation = await client.StartTranslationAsync(input);
await operation.WaitForCompletionAsync();
I have tried both file level and container level SAS, and even account level SAS with All permissions.
The error messages received are all the same.
I am sure the permissions are correct because I can open the uri of the source file normally in the browser.
After repeated attempts, I found the problem!
When instantiating the DocumentTranslationInput object, the StorageUriKind property defaults to null.
This corresponds to the StorageType parameter in the API.
In the documentation, this is not a required parameter, and I suspect that when I use the SAS URI, it incorrectly identifies the File as Folder, leading to permission issues.
Indeed, testing confirmed my suspicion. When I manually set the StorageUriKind to File, it works!
DocumentTranslationInput input = new DocumentTranslationInput(
new Uri("https://xxx.blob.core.windows.net/translator-source/testfile.pdf?<SAS>"),
new Uri("https://xxx.blob.core.windows.net/translator-target/testfile.en.pdf?<SAS>"),
"en") { StorageUriKind= StorageInputUriKind.File };
Additionally, I tried changing the Uri from a file to a container or directory, while keeping the StorageUriKind at its default null setting.
DocumentTranslationInput input = new DocumentTranslationInput(
new Uri("https://xxx.blob.core.windows.net/translator-source/?<SAS>"),
new Uri("https://xxx.blob.core.windows.net/translator-target/?<SAS>"),
"en");
This also worked as expected, translating all files within the file directory.
Hoping This Helps