Rediger

Del via


Create a Document Translation flow (preview)

Important

The Translator connector is currently available in public preview. Features, approaches and processes may change, prior to General Availability (GA), based on user feedback.

This tutorial guides you through configuring a Microsoft Translator V3 connector cloud flow that supports document translation. The Translator V3 connector creates a connection between your Translator Service instance and Microsoft Power Automate enabling you to use one or more prebuilt operations as steps in your apps and workflows.

Document Translation is a cloud-based REST API feature of the Azure AI Translator service. The Document Translation API enables multiple and complex document translations while preserving original document structure and data format.

In this tutorial:

Prerequisites

Here's what you need to get started: Translator resource, Azure storage account with at least two containers, and a system-assigned managed identity with role-based access.

Translator resource

  • If you don't have an active Azure account, you can create one for free.

  • Create a single-service Translator resource (not a multi-service Azure AI services resource). As you complete the Translator project and instance details fields, pay special attention to the following entries:

    • Resource Region. Choose a geographic region like West US (not the Global region).

    • Pricing tier. Select Standard S1 to try the service.

  • Use the key and name from your Translator resource to connect your application to Power Automate. Your Translator resource keys are found under the Resource Management section in the Azure portal and your resource name is located at the top of the page.

    Get key and endpoint.

  • Copy and paste your key and resource name in a convenient location, such as Microsoft Notepad.

Azure storage

  • Next, you need an Azure Blob Storage account and at least two containers for your source and target files:

    • Source container. This container is where you upload your files for translation (required).
    • Target container. This container is where your translated files are stored (required).
  • If your storage account is behind a firewall, you must enable additional configurations:

    1. Go to the Azure portal and sign in to your Azure account.

    2. Select your Storage account.

    3. In the Security + networking group in the left pane, select Networking.

    4. In the Firewalls and virtual networks tab, select Enabled from selected virtual networks and IP addresses.

      Screenshot: Selected networks radio button selected.

    5. Deselect all check boxes.

    6. Make sure Microsoft network routing is selected.

    7. Under the Resource instances section, select Microsoft.CognitiveServices/accounts as the resource type and select your Translator resource as the instance name.

    8. Make certain that the Allow Azure services on the trusted services list to access this storage account box is checked. For more information about managing exceptions, see Configure Azure Storage firewalls and virtual networks.

      Screenshot: allow trusted services checkbox, portal view.

    9. Select Save. It may take up to 5 min for the network changes to propagate.

Managed identity with RBAC

Finally, before you can use the Translator V3 connector's operations for document translation, you must grant your Translator resource access to your storage account using a managed identity with role based identity control (RBAC).

Screenshot of managed identity flow (RBAC).

Create a managed identity

First, create a system-assigned managed identity for your Translator resource and grant that identity specific permissions to access your Azure storage account:

  1. Go to the Azure portal and sign in to your Azure account.

  2. Select the Translator resource.

  3. In the Resource Management group in the left pane, select Identity.

  4. Within the System assigned tab, turn on the Status toggle.

  5. Select Save.

    Screenshot: resource management identity tab in the Azure portal.

Role assignment

Next, assign a Storage Blob Data Contributor role to the managed identity at the storage scope for your storage resource.

  1. Go to the Azure portal and sign in to your Azure account.

  2. Select the Translator resource.

  3. In the Resource Management group in the left pane, select Identity.

  4. Under Permissions select Azure role assignments:

    Screenshot: enable system-assigned managed identity in Azure portal.

  5. On the Azure role assignments page that opened, choose your subscription from the drop-down menu then select + Add role assignment.

    Screenshot: Azure role assignments page in the Azure portal.

  6. Finally, assign a Storage Blob Data Contributor role to your Translator service resource. 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. In the Add role assignment pop-up window, complete the fields as follows and select Save:

    Field Value
    Scope Storage.
    Subscription The subscription associated with your storage resource.
    Resource The name of your storage resource.
    Role Storage Blob Data Contributor.
  7. After the Added Role assignment confirmation message appears, refresh the page to see the added role assignment.

    Screenshot: Added role assignment confirmation pop-up message.

  8. If you don't see the new role assignment right away, wait and try refreshing the page again. When you assign or remove role assignments, it can take up to 30 minutes for changes to take effect.

    Screenshot: Azure role assignments window.

Configure a Document Translation flow

Now that you completed the prerequisites and initial setup, let's get started using the Translator V3 connector to create your document translation flow:

  1. Sign in to Power Automate.

  2. Select Create from the left sidebar menu.

  3. Select Instant cloud flow from the main content area.

    Screenshot showing how to create an instant cloud flow.

  4. In the popup window, name your flow then choose Manually trigger a flow and select Create.

    Screenshot showing how to manually trigger a flow.

  5. The first step for your instant flow—Manually trigger a flow—appears on screen. Select New step.

    Screenshot of add new flow step page.

Translate documents

Next, we're ready to select an action. You can translate documents located in your Azure Blob Storage or Microsoft SharePoint account.

Azure Blob Storage

Here are the steps to translate a file in Azure Blob Storage using the Translator V3 connector:

  • Choose the Translator V3 connector.
  • Select document translation.
  • Enter your Azure Blob Storage credentials and container locations.
  • Translate your document(s) choosing source and target languages.
  • Get the status of the translation operation.
  1. In the Choose an operation pop-up window, enter Translator V3 in the Search connectors and actions search bar and select the Microsoft Translator V3 icon.

    Screenshot showing the selection of Translator V3 as the next flow step.

  2. Select the Start document translation action.

  3. If you're using the Translator V3 connector for the first time, you need to enter your resource credentials:

    • Connection name. Enter a name for your connection.

    • Subscription Key. Your Translator resource keys are found under the Resource Management section of the resource sidebar in the Azure portal. Enter one of your keys. Make certain that your Translator resource is assigned to a geographical region such as West US (not global).

    • Translator resource name. Enter the name of your Translator resource found at the top of your resource page in the Azure portal. Select Create.

      Screenshot showing the  how-to-add connection window.

      Note

      After you've set up your connection, you won't be required to reenter your credentials for subsequent flows.

  4. The Start document translation action window now appears. Complete the fields as follows:

    • For Storage type of the input documents. Select File or Folder.

    • Select a Source Language from the dropdown menu or keep the default Auto-detect option.

    • Location of the source documents. Enter the URL for your documents in your Azure storage source document container.

    • Location of the translated documents. Enter the URL for your Azure storage target document container.

      To find your source and target URLs:

      • Navigate to your storage account in the Azure portal.

      • In the left sidebar, under Data storage , select Containers:

        Source Target
        Select the checkbox next to the source container Select the checkbox next to the target container.
        From the main window area, select a file or document for translation. Select the ellipses located at the right, then choose Properties.
        The source URL is located at the top of the Properties list. Select the Copy to Clipboard icon. The target URL is located at the top of the Properties list. Select the Copy to Clipboard icon.
        Navigate to your Power automate flow and paste the source URL in the Location of the source documents field. Navigate to your Power automate flow and paste the target URL in the Location of the translated documents field.
    • Choose a Target Language from the dropdown menu and select Save.

      Screenshot of the Start document translation dialog window.

Get documents status

Now that you submitted your documents for translation, let's check the status of the operation.

  1. Select New step.

  2. Enter Translator V3 in the search box and choose Microsoft Translator V3.

  3. Select Get documents status (not the singular Get document status action).

    Screenshot of the get documents status step.

  4. Next, you're going to enter an expression to retrieve the operation ID value.

  5. Select the operation ID field. A Dynamic content / Expression dropdown window appears.

  6. Select the Expression tab and enter the following expression into the function field:

    
       body('Start_document_translation').operationID
    
    

    Screenshot showing function creation window.

  7. Select OK. The function appears in the Operation ID window. Select Save.

    Screenshot showing the operation ID field with an expression function value.

Test the connector flow

Time to check our flow and document translation results.

  1. There's a green bar at the top of the page indicating that Your flow is ready to go.

  2. Select Test from the upper-right corner of the page.

    Screenshot showing the test icon/button.

  3. Select the following buttons: Test FlowManuallyTest from the right-side window.

  4. In the next window, select the Run flow button.

  5. Finally, select the Done button.

  6. You should receive a Your flow ran successfully message and green check marks align with each successful step.

    Screenshot of successful document translation flow.

  7. Select the Get documents status step, then select Show raw outputs from the Outputs section.

  8. A Get documents status window appears. At the top of the JSON response, you see "statusCode":200 indicating that the request was successful.

    Screenshot showing the 'Get documents status' JSON response.

  9. As a final check, navigate to your Azure Blob Storage target source container. There, you should see the translated document in the Overview section. The document may be in a folder labeled with the translation language code.

That's it! You learned to automate document translation processes using the Microsoft Translator V3 connector and Power Automate.

Next steps