tokens&
For enterprises
Submit
Sign in
tokens&

Build better AI stacks, claim useful opportunities, and give AI infrastructure companies a source-labeled adoption readout they can trust.

For buildersFor enterprises

Product

  • For builders
  • Category rankings
  • Startup credits and perks
  • Agent Skills
  • Platform
  • Submit project, tool, product, or perk

Enterprise

  • Start free company workspace

Community

  • Community
  • Newsletter
  • Events
Xin

© 2026 tokensand, LLC. All rights reserved.

  • Terms
  • Privacy
  • Security
  • Data Processing
  • Status
Agent Skills/Azure document translation for Python
MicrosoftDocsSKILL.mdVerified source

Agent Skill

Azure document translation for Python

Batch-translate Word, PDF, Excel, and PowerPoint files while preserving document formatting.

Install this skillView repository

Vendor-authored source · MIT license.

Raw SKILL.mdInstall the Tokens& Agent Pack

Skill specification

Declared by Microsoft in the package front matter. Trigger conditions are what the coding agent matches on before it loads the skill.

View package fields
Azure document translation for Python SKILL.md front matter fields
Skill nameazure-ai-translation-document-py
Trigger conditionsAzure AI Document Translation SDK for batch translation of documents with format preservation. Use for translating Word, PDF, Excel, PowerPoint, and other document formats at scale. Triggers: "document translation", "batch translation", "translate documents", "DocumentTranslationClient".
Declared licenseMIT
Version1.0.0
AuthorMicrosoft
Packageazure-ai-translation-document

Install azure-ai-translation-document-py

In a terminal with Node.js, npm and Git, run the command for your agent. The Skills CLI installs the complete package directory, including referenced files within it. Review its install prompt, then start a new agent session. A skill package does not set up an MCP server connection.

Claude Code

.claude/skills/azure-ai-translation-document-py/SKILL.md

Project skills are committed with the repo. Use the user directory for a personal install across every project.

Project install

npx skills add 'https://github.com/microsoft/skills/tree/main/.github/plugins/azure-sdk-python/skills/azure-ai-translation-document-py' --skill 'azure-ai-translation-document-py' --agent 'claude-code'
Install for all projects instead

Personal install

npx skills add 'https://github.com/microsoft/skills/tree/main/.github/plugins/azure-sdk-python/skills/azure-ai-translation-document-py' --skill 'azure-ai-translation-document-py' --agent 'claude-code' --global

Codex

.agents/skills/azure-ai-translation-document-py/SKILL.md

Codex reads `.agents/skills/` as its primary location, which is also the cross-platform default other clients honour.

Project install

npx skills add 'https://github.com/microsoft/skills/tree/main/.github/plugins/azure-sdk-python/skills/azure-ai-translation-document-py' --skill 'azure-ai-translation-document-py' --agent 'codex'
Install for all projects instead

Personal install

npx skills add 'https://github.com/microsoft/skills/tree/main/.github/plugins/azure-sdk-python/skills/azure-ai-translation-document-py' --skill 'azure-ai-translation-document-py' --agent 'codex' --global

Cursor

.agents/skills/azure-ai-translation-document-py/SKILL.md

Cursor also loads `.agents/skills/`, `.claude/skills/`, and `.codex/skills/`, so one committed copy can serve several clients.

Project install

npx skills add 'https://github.com/microsoft/skills/tree/main/.github/plugins/azure-sdk-python/skills/azure-ai-translation-document-py' --skill 'azure-ai-translation-document-py' --agent 'cursor'
Install for all projects instead

Personal install

npx skills add 'https://github.com/microsoft/skills/tree/main/.github/plugins/azure-sdk-python/skills/azure-ai-translation-document-py' --skill 'azure-ai-translation-document-py' --agent 'cursor' --global

Gemini CLI

.agents/skills/azure-ai-translation-document-py/SKILL.md

Gemini CLI reads `.agents/skills/` first when both directories exist.

Project install

npx skills add 'https://github.com/microsoft/skills/tree/main/.github/plugins/azure-sdk-python/skills/azure-ai-translation-document-py' --skill 'azure-ai-translation-document-py' --agent 'gemini-cli'
Install for all projects instead

Personal install

npx skills add 'https://github.com/microsoft/skills/tree/main/.github/plugins/azure-sdk-python/skills/azure-ai-translation-document-py' --skill 'azure-ai-translation-document-py' --agent 'gemini-cli' --global

GitHub Copilot

.agents/skills/azure-ai-translation-document-py/SKILL.md

The Skills CLI uses the shared `.agents/skills/` directory for Copilot project installs.

Project install

npx skills add 'https://github.com/microsoft/skills/tree/main/.github/plugins/azure-sdk-python/skills/azure-ai-translation-document-py' --skill 'azure-ai-translation-document-py' --agent 'github-copilot'
Install for all projects instead

Personal install

npx skills add 'https://github.com/microsoft/skills/tree/main/.github/plugins/azure-sdk-python/skills/azure-ai-translation-document-py' --skill 'azure-ai-translation-document-py' --agent 'github-copilot' --global

SKILL.md

View raw source

Published by Microsoft under MIT. Rendered from the package in github.com/microsoft/skills/tree/main/.github/plugins/azure-sdk-python/skills/azure-ai-translation-document-py.

Read full skill instructions

Azure AI Document Translation SDK for Python

Client library for Azure AI Translator document translation service for batch document translation with format preservation.

Installation

pip install azure-ai-translation-document

Environment Variables

AZURE_DOCUMENT_TRANSLATION_ENDPOINT=https://<resource>.cognitiveservices.azure.com  # Required for all auth methods
# Storage for source and target documents
AZURE_SOURCE_CONTAINER_URL=https://<storage>.blob.core.windows.net/<container>?<sas>  # Required for all auth methods
AZURE_TARGET_CONTAINER_URL=https://<storage>.blob.core.windows.net/<container>?<sas>  # Required for all auth methods
AZURE_TOKEN_CREDENTIALS=prod # Required only if DefaultAzureCredential is used in production
AZURE_DOCUMENT_TRANSLATION_KEY=<your-api-key>  # Only required for the legacy API-key auth path below

Authentication & Lifecycle

🔑 Two rules apply to every code sample below: 1. Prefer `DefaultAzureCredential`. It works locally (Azure CLI / VS Code / Developer CLI) and in Azure (managed identity, workload identity) with no code change. Avoid connection strings, account/API keys — they bypass Entra audit and rotation. - Local dev: DefaultAzureCredential works as-is. - Production: set AZURE_TOKEN_CREDENTIALS=prod (or AZURE_TOKEN_CREDENTIALS=<specific_credential>) to constrain the credential chain to production-safe credentials. 2. Wrap every client in a context manager so HTTP transports, sockets, and token caches are released deterministically: - Sync: with <Client>(...) as client: - Async: async with <Client>(...) as client: and async with DefaultAzureCredential() as credential: (from azure.identity.aio) Snippets may abbreviate this setup, but production code should always follow both rules.
import os
from azure.identity import DefaultAzureCredential, ManagedIdentityCredential
from azure.ai.translation.document import DocumentTranslationClient

# Local dev: DefaultAzureCredential. Production: set AZURE_TOKEN_CREDENTIALS=prod or AZURE_TOKEN_CREDENTIALS=<specific_credential>
credential = DefaultAzureCredential()
# Or use a specific credential directly in production:
# See https://learn.microsoft.com/python/api/overview/azure/identity-readme?view=azure-python#credential-classes
# credential = ManagedIdentityCredential()

with DocumentTranslationClient(
    endpoint=os.environ["AZURE_DOCUMENT_TRANSLATION_ENDPOINT"],
    credential=credential,
) as client:
    statuses = list(client.list_translation_statuses())

Legacy: API Key (existing keyed deployments)

New code should use DefaultAzureCredential above. Use AzureKeyCredential only if you have an existing keyed deployment that hasn't been migrated to Entra ID yet — for example, regulated environments still completing their Entra rollout.

import os
from azure.core.credentials import AzureKeyCredential
from azure.ai.translation.document import DocumentTranslationClient, SingleDocumentTranslationClient

with DocumentTranslationClient(
    endpoint=os.environ["AZURE_DOCUMENT_TRANSLATION_ENDPOINT"],
    credential=AzureKeyCredential(os.environ["AZURE_DOCUMENT_TRANSLATION_KEY"]),
) as client:
    statuses = list(client.list_translation_statuses())

# SingleDocumentTranslationClient accepts the same key-based credential.

Basic Document Translation

import os
from azure.ai.translation.document import DocumentTranslationClient, DocumentTranslationInput, TranslationTarget
from azure.core.exceptions import HttpResponseError
from azure.identity import DefaultAzureCredential

credential = DefaultAzureCredential()

with DocumentTranslationClient(
    endpoint=os.environ["AZURE_DOCUMENT_TRANSLATION_ENDPOINT"],
    credential=credential,
) as client:
    source_url = os.environ["AZURE_SOURCE_CONTAINER_URL"]
    target_url = os.environ["AZURE_TARGET_CONTAINER_URL"]

    try:
        # Start translation job
        poller = client.begin_translation(
            inputs=[
                DocumentTranslationInput(
                    source_url=source_url,
                    targets=[
                        TranslationTarget(
                            target_url=target_url,
                            language="es"  # Translate to Spanish
                        )
                    ]
                )
            ]
        )

        # Wait for completion
        result = poller.result()

        print(f"Status: {poller.status()}")
        print(f"Documents translated: {poller.details.documents_succeeded_count}")
        print(f"Documents failed: {poller.details.documents_failed_count}")
    except HttpResponseError as e:
        print(f"Translation failed: {e.message}")
        raise

Multiple Target Languages

poller = client.begin_translation(
    inputs=[
        DocumentTranslationInput(
            source_url=source_url,
            targets=[
                TranslationTarget(target_url=target_url_es, language="es"),
                TranslationTarget(target_url=target_url_fr, language="fr"),
                TranslationTarget(target_url=target_url_de, language="de")
            ]
        )
    ]
)

Translate Single Document

from azure.ai.translation.document import SingleDocumentTranslationClient
from azure.identity import DefaultAzureCredential

with open("document.docx", "rb") as f:
    document_content = f.read()

with SingleDocumentTranslationClient(endpoint, DefaultAzureCredential()) as single_client:
    result = single_client.translate(
        body=document_content,
        target_language="es",
        content_type="application/vnd.openxmlformats-officedocument.wordprocessingml.document"
    )

# Save translated document
with open("document_es.docx", "wb") as f:
    f.write(result)

Check Translation Status

# Get all translation operations
operations = client.list_translation_statuses()

for op in operations:
    print(f"Operation ID: {op.id}")
    print(f"Status: {op.status}")
    print(f"Created: {op.created_on}")
    print(f"Total documents: {op.documents_total_count}")
    print(f"Succeeded: {op.documents_succeeded_count}")
    print(f"Failed: {op.documents_failed_count}")

List Document Statuses

# Get status of individual documents in a job
operation_id = poller.id
document_statuses = client.list_document_statuses(operation_id)

for doc in document_statuses:
    print(f"Document: {doc.source_document_url}")
    print(f"  Status: {doc.status}")
    print(f"  Translated to: {doc.translated_to}")
    if doc.error:
        print(f"  Error: {doc.error.message}")

Cancel Translation

# Cancel a running translation
client.cancel_translation(operation_id)

Using Glossary

from azure.ai.translation.document import TranslationGlossary

poller = client.begin_translation(
    inputs=[
        DocumentTranslationInput(
            source_url=source_url,
            targets=[
                TranslationTarget(
                    target_url=target_url,
                    language="es",
                    glossaries=[
                        TranslationGlossary(
                            glossary_url="https://<storage>.blob.core.windows.net/glossary/terms.csv?<sas>",
                            file_format="csv"
                        )
                    ]
                )
            ]
        )
    ]
)

Supported Document Formats

# Get supported formats
formats = client.get_supported_document_formats()

for fmt in formats:
    print(f"Format: {fmt.format}")
    print(f"  Extensions: {fmt.file_extensions}")
    print(f"  Content types: {fmt.content_types}")

Supported Languages

# Get supported languages
languages = client.get_supported_languages()

for lang in languages:
    print(f"Language: {lang.name} ({lang.code})")

Async Client

from azure.ai.translation.document.aio import DocumentTranslationClient
from azure.identity.aio import DefaultAzureCredential

async def translate_documents():
    async with DefaultAzureCredential() as credential:
        async with DocumentTranslationClient(
            endpoint=endpoint,
            credential=credential,
        ) as client:
            poller = await client.begin_translation(inputs=[...])
            result = await poller.result()

Supported Formats

CategoryFormats
DocumentsDOCX, PDF, PPTX, XLSX, HTML, TXT, RTF
StructuredCSV, TSV, JSON, XML
LocalizationXLIFF, XLF, MHTML

Storage Requirements

  • Source and target containers must be Azure Blob Storage
  • Use SAS tokens with appropriate permissions:
  • Source: Read, List
  • Target: Write, List

Best Practices

  1. Pick sync OR async and stay consistent. Do not mix azure.xxx sync clients with azure.xxx.aio async clients in the same call path. Choose one mode per module.
  2. Always use context managers for clients and async credentials. Wrap every client in with Client(...) as client: (sync) or async with Client(...) as client: (async). For async DefaultAzureCredential from azure.identity.aio, also use async with credential: so tokens and transports are cleaned up.
  3. Use SAS tokens with minimal required permissions
  4. Monitor long-running operations with poller.status()
  5. Handle document-level errors by iterating document statuses
  6. Use glossaries for domain-specific terminology
  7. Separate target containers for each language
  8. Use async client for multiple concurrent jobs
  9. Check supported formats before submitting documents

Reference Files

FileContents
references/capabilities.mdAdditional non-hero capabilities, operation-group coverage, and production checklists.
references/non-hero-scenarios.mdDedicated non-hero examples for secondary/advanced scenarios.

More Microsoft Agent Skills

All Agent Skills

Application Insights web instrumentation

Instrument browser apps for RUM, dependencies, exceptions, custom events, and correlated agent traces.

Frontend

Azure AI content safety for Python

Detect harmful text and image content with severity-aware moderation workflows in Python.

Models

Azure AI Projects for TypeScript

Build Foundry applications with project clients, agents, deployments, datasets, indexes, and evaluations.

Agents

Azure AI Search for TypeScript

Build vector, hybrid, semantic, and agentic retrieval workflows with the Azure AI Search SDK.

Backend

Azure cloud solution architect

Design and review Azure systems against architecture patterns and Well-Architected Framework tradeoffs.

Backend

Azure Cosmos DB for TypeScript

Implement Cosmos DB document CRUD, queries, partitioning, bulk operations, and container management.

Backend