Hello Joseph Dougherty,
Welcome to the Microsoft Q&A and thank you for posting your questions here.
I understand that you would like to resolve access issue to storage account.
This is what you need to do considering all indicated errors. Please regenerate valid SAS tokens with correct permissions as described below, and make sure public blob access is enabled in your storage configuration. Also, declare the targetUri explicitly in your code and ensure both SAS URLs are correctly formatted.
- Regenerate valid SAS tokens because source container (needs: Read, List): Go to Azure Portal > Storage Account > Containers Select your source container. Click Shared Access Signature or generate using Azure CLI bash command as below:
And the target container (Needs: Write, Create, List), use similar steps, but permissions should be:az storage container generate-sas \ --name containerfortranslatingdocs \ --permissions rl \ --expiry 2025-08-31T00:00:00Z \ --account-name storagefortranslator \ --as-user \ --auth-mode login
wcl
. See the Azure SAS permissions - https://learn.microsoft.com/en-us/azure/storage/common/storage-sas-overview as reference. - Secondly, if your Azure environment blocks blob-level public access, even valid SAS tokens may fail. Go to Storage Account > Configuration and set: Allow Blob public access to Enabled
- Check here for more details - https://learn.microsoft.com/en-us/azure/storage/blobs/anonymous-read-access-configure
- Make sure URLs contain
&
and not&
The final SAS URL format should be like:https://<account>.blob.core.windows.net/<container>/<filename>.docx?<SAS>
- Your C# code need to be refactored as below:
using Azure; using Azure.AI.Translation.Document; using System; using System.Threading.Tasks; class Program { private static readonly string endpoint = "https://translatorjoedocsr.cognitiveservices.azure.com/"; private static readonly string key = "<your-translator-key>"; // Never hardcode in production! static async Task Main(string[] args) { Uri sourceUri = new Uri("https://storagefortranslator.blob.core.windows.net/containerfortranslatingdocs/AdministrativeDenialLetter.docx?<valid-sas>"); Uri targetUri = new Uri("https://storagefortranslator.blob.core.windows.net/<target-container>?<valid-sas>"); string targetLanguage = "es"; // Spanish try { var client = new DocumentTranslationClient(new Uri(endpoint), new AzureKeyCredential(key)); var input = new DocumentTranslationInput( new TranslationSource(sourceUri), new TranslationTarget(targetUri, targetLanguage) ); DocumentTranslationOperation operation = await client.StartTranslationAsync(input); await operation.WaitForCompletionAsync(); Console.WriteLine($"Status: {operation.Status}"); Console.WriteLine($"Succeeded: {operation.DocumentsSucceeded}"); Console.WriteLine($"Failed: {operation.DocumentsFailed}"); } catch (Exception ex) { Console.WriteLine($"Error: {ex.Message}"); } } }
- Though this is an optional, if running from Azure App Service, Function App, or VM, use Managed Identity with RBAC roles: The Source container should have role of
Storage Blob Data Reader
and Target container should haveStorage Blob Data Contributor
Read the following links:
I hope this is helpful! Do not hesitate to let me know if you have any other questions or clarifications.
Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.