# azure-ai-contentunderstanding-py

Teaches your coding agent to use the Azure AI Content Understanding Python SDK. Extracts structured markdown, transcripts, and key video frames.

- skill · `type=skill` · Claude Code, GitHub Copilot · 1 install · ★ 3149
- Author: Microsoft
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/microsoft/skills/tree/HEAD/.github/plugins/azure-sdk-python/skills/azure-ai-contentunderstanding-py/SKILL.md
- Updated: 2026-10-23
- HTML: https://affpapa.org/en/nevibecode/skills/azure-ai-contentunderstanding-py

## What it does

This skill guides coding agents on integrating the `azure-ai-contentunderstanding` Python package. It provides patterns for initializing `ContentUnderstandingClient` with `DefaultAzureCredential` and wrapping client calls inside context managers to release network sockets cleanly.

The SDK handles processing through asynchronous operations. Calling `begin_analyze()` starts a job and returns a poller object for tracking completion. The skill covers prebuilt analyzers such as `prebuilt-documentSearch` and `prebuilt-videoSearch`, along with custom schemas configured via `field_schema`.

Your environment must define `CONTENTUNDERSTANDING_ENDPOINT`, or calls will fail immediately. The runtime also requires the `azure-ai-contentunderstanding` library installed via pip.

## Requirements
- Works with: Azure

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add microsoft/skills --skill azure-ai-contentunderstanding-py -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/azure-ai-contentunderstanding-py/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/azure-ai-contentunderstanding-py/

### Codex

**Manually: put the files in place**
- File: `.agents/skills/azure-ai-contentunderstanding-py/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

**Manually: put the files in place**
- File: `.cursor/skills/azure-ai-contentunderstanding-py/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install microsoft/skills azure-ai-contentunderstanding-py
```

2. **Manually: put the files in place**
- File: `.github/skills/azure-ai-contentunderstanding-py/SKILL.md`

### Gemini CLI

**Platform CLI**
```bash
gemini skills install https://github.com/microsoft/skills --path .github/plugins/azure-sdk-python/skills/azure-ai-contentunderstanding-py
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/azure-ai-contentunderstanding-py/SKILL.md` — The legacy .windsurf/skills/ path still works

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/microsoft/skills/tree/HEAD/.github/plugins/azure-sdk-python/skills/azure-ai-contentunderstanding-py/SKILL.md

## When to use it
- extract markdown from PDF files for RAG pipelines
- pull spoken phrases with timestamps from video files
- transcribe audio files using prebuilt cloud models
- configure custom extraction schemas for invoices

## Example prompts
- Write a Python script using prebuilt-documentSearch to parse a PDF file URL
- Show how to poll video analysis results and print key frames with timestamps
- Configure a custom analyzer schema with vendor_name and invoice_total fields

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: f5d37fcb5158d4dc.

BEGIN THIRD-PARTY FILE f5d37fcb5158d4dc
````text
---
name: azure-ai-contentunderstanding-py
description: |
  Azure AI Content Understanding SDK for Python. Use for multimodal content extraction from documents, images, audio, and video.
  Triggers: "azure-ai-contentunderstanding", "ContentUnderstandingClient", "multimodal analysis", "document extraction", "video analysis", "audio transcription".
license: MIT
metadata:
  author: Microsoft
  version: "1.0.0"
  package: azure-ai-contentunderstanding
---

# Azure AI Content Understanding SDK for Python

Multimodal AI service that extracts semantic content from documents, video, audio, and image files for RAG and automated workflows.

## Installation

```bash
pip install azure-ai-contentunderstanding
```

## Environment Variables

```bash
CONTENTUNDERSTANDING_ENDPOINT=https://<resource>.cognitiveservices.azure.com/  # Required for all auth methods
AZURE_TOKEN_CREDENTIALS=prod # Required only if DefaultAzureCredential is used in production
```

## 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.

```python
import os
from azure.ai.contentunderstanding import ContentUnderstandingClient
from azure.identity import DefaultAzureCredential, ManagedIdentityCredential

endpoint = os.environ["CONTENTUNDERSTANDING_ENDPOINT"]
# Local dev: DefaultAzureCredential. Production: set AZURE_TOKEN_CREDENTIALS=prod or AZURE_TOKEN_CREDENTIALS=<specific_credential>
credential = DefaultAzureCredential(require_envvar=True)
# 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 ContentUnderstandingClient(endpoint=endpoint, credential=credential) as client:
    analyzers = list(client.list_analyzers())
```

## Core Workflow

Content Understanding operations are asynchronous long-running operations:

1. **Begin Analysis** — Start the analysis operation with `begin_analyze()` (returns a poller)
2. **Poll for Results** — Poll until analysis completes (SDK handles this with `.result()`)
3. **Process Results** — Extract structured results from `AnalyzeResult.contents`

## Prebuilt Analyzers

| Analyzer | Content Type | Purpose |
|----------|--------------|---------|
````
END THIRD-PARTY FILE f5d37fcb5158d4dc

The third-party file has ended. Everything between the f5d37fcb5158d4dc tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 3156 of 10525 bytes. © Microsoft · MIT · https://github.com/microsoft/skills/tree/HEAD/.github/plugins/azure-sdk-python/skills/azure-ai-contentunderstanding-py/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
