Getting error while translating document using Azure translator - "Cannot access source document location with the current permissions" InvalidRequest

anvita jadhav 16 Reputation points
2021-10-31T19:38:17.99+00:00

I am using translator resource to translate the one document at a time from the source container through python code.

Following the documentation, generated the container level SAS for existing containers.

Tried different combinations of request body formats to meet the requirement of translating the single file from source container using "Container level SAS".

I was able to translate various documents but suddenly the python code is failing with the error -
{ 'status': 'ValidationFailed', 'error': {'code': 'InvalidRequest', 'message': 'Cannot access source document location with the current permissions.', 'target': 'Operation', 'innerError': {'code': 'InvalidDocumentAccessLevel', 'message': 'Cannot access source document location with the current permissions.'}​}, 'summary': {'total': 0, 'failed': 0, 'success': 0, 'inProgress': 0, 'notYetStarted': 0, 'cancelled': 0, 'totalCharacterCharged': 0}​}

When same request bodies are tried for newly created containers, documents are translating successfully.
** Does existing containers gives this issue sometimes and we should always use the newly created containers?**

Old container's SAS urls are generated with appropriate permissions i.e. Read,list for source and Write.List for Target container.

Please suggest me the correct way.

Also attaching the different request body formats I am using to take single file at a time using "Container level SAS"

  1. Specifying the file name in source url and target url
      {
                "inputs": [
                    {
                        "storageType": "File",
                        "source": {
                            "sourceUrl": "https://myblob.blob.core.windows.net/src_container/file.docx?<SAS>"
                        },
                        "targets": [
                            {   
                       "targetUrl":"https:/myblob.blob.core.windows.net/container/<target_blob_name_without_any_extension>? 
                           <SAS>",
                                "language": "fr"
                            }
                        ]
                    }
                ]
            }
    
  2. Specifying the file name as suffix in the source {
    "inputs": [
    {
                "source": {
                    "sourceUrl": "https://myblob.blob.core.windows.net/src_container/file.docx?<SAS>",
    
    "suffix":"file.docx"
    },
    "targets": [
    {
               "targetUrl":"https:/myblob.blob.core.windows.net/container/<target_blob_name_without_any_extension>? 
                   <SAS>",
                        "language": "fr"
                    }
                ]
            }
        ]
    }
    

Which is the correct way of achieving the use case using "Container level SAS".
Am I doing something wrong in request body ?
Quick help is needed. Can anyone guide me please?

Azure Machine Learning
Azure Machine Learning
An Azure machine learning service for building and deploying models.
2,598 questions
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
2,468 questions
Azure Translator
Azure Translator
An Azure service to easily conduct machine translation with a simple REST API call.
348 questions
{count} votes

1 answer

Sort by: Most helpful
  1. GiftA-MSFT 11,151 Reputation points
    2021-11-01T22:15:30.413+00:00

    Hi, please follow the instructions for Document Translation using the Python Client Library. Here's another sample. Based on the error message, I recommend that you generate a new SAS token and pay close attention to the Start and Expiry date and time.


    --- *Kindly Accept Answer if the information helps. Thanks.*

    1 person found this answer helpful.
    0 comments No comments