Azure AI-901 · Module 6 · Session 10

Session 10: Azure Content Understanding

⏱ 10 min read📘 Live-session notes☁️ Microsoft Foundry

Turn documents, images, audio and video into structured data with Azure Content Understanding in Foundry Tools: what it does and when to use it, extracting fields from invoices, receipts and IDs, extracting information from images, audio and video, and a lightweight app that outputs structured JSON.

What Content Understanding does

Azure Content Understanding in Foundry Tools is a multimodal extraction service. You send content in, and it returns:

It uses generative models behind the scenes (you connect default model deployments once), but you work with a schema, not prompts, so the output is consistent and machine-readable.

Content Understanding Prompting a multimodal LLM yourself
Output Typed fields against a schema, with confidence and source grounding Free text or JSON that depends on your prompt
Modalities Documents, images, audio, video in one service Mostly text and images
Scale and operations Built for high-volume processing, async jobs You build parsing, validation and retries
Best for Invoices, forms, claims, call recordings, video indexing Quick one-off questions about a file

Analyzers and field schemas

An analyzer is the configuration that says how to process content and which fields to extract.

Field Type Method / description
InvoiceNumber string Extract the invoice number exactly as printed
InvoiceDate date Extract the issue date
VendorName string Extract the seller’s company name
TotalAmount number Extract the grand total including tax
LineItems array of objects Description, quantity, unit price, amount
IsOverdue boolean Generate: inferred, for example “is the due date in the past?”
ExpenseCategory string (enum) Classify into travel / IT / office / other

Field methods: extract (copy a value that appears in the content), generate (infer or summarise from the content) and classify (pick one value from a list).

Documents and forms

PDF / scan ─► analyzer (prebuilt-invoice or custom) ─► markdown + tables + fields { value, confidence, source }

Use cases: invoices and purchase orders, receipts for expense apps, KYC documents (PAN, Aadhaar, passport), insurance claim forms, bank statements.

Images

The same approach works for single images: product photos, meter readings, damaged-vehicle photos, shelf images. Example custom fields: MeterReading: number, DamageVisible: boolean, DamageDescription: string.

Audio and video

Typical uses: call-centre quality checks, meeting minutes, indexing training videos for search, media moderation.

Calling Content Understanding from Python

The REST pattern is asynchronous: POST to analyze, read the Operation-Location header, then poll until status is Succeeded.

import os, time, json, requests
from dotenv import load_dotenv

load_dotenv()
ENDPOINT = os.environ["FOUNDRY_RESOURCE_ENDPOINT"].rstrip("/")     # https://<resource>.services.ai.azure.com
KEY = os.environ["FOUNDRY_KEY"]
API = "2025-11-01"
HEADERS = {"Ocp-Apim-Subscription-Key": KEY, "Content-Type": "application/json"}

def analyze(analyzer_id, url):
    r = requests.post(f"{ENDPOINT}/contentunderstanding/analyzers/{analyzer_id}:analyze?api-version={API}",
                      headers=HEADERS, json={"inputs": [{"url": url}]})
    r.raise_for_status()                                        # expect 202 Accepted
    poll_url = r.headers["Operation-Location"]
    while True:
        result = requests.get(poll_url, headers={"Ocp-Apim-Subscription-Key": KEY}).json()
        if result["status"] in ("Succeeded", "Failed"):
            return result
        time.sleep(2)                                           # NotStarted / Running

res = analyze("prebuilt-invoice",
              "https://github.com/Azure-Samples/azure-ai-content-understanding-python/raw/refs/heads/main/data/invoice.pdf")
fields = res["result"]["contents"][0]["fields"]
for name, f in fields.items():                                  # e.g. CustomerName, InvoiceDate, TotalAmount, LineItems
    value = next((v for k, v in f.items() if k.startswith("value")), None)
    print(f"{name:18} {json.dumps(value, default=str)[:60]:62} confidence={f.get('confidence')}")

Reading the result:

Files must be reachable by the service: a public URL or an Azure Blob Storage URL with a SAS token. In Content Understanding Studio you can also upload files directly while designing an analyzer.

Check yourself

A company needs invoice number, vendor and total from thousands of PDFs, each with a confidence score. Which Foundry tool? Azure Content Understanding, with the prebuilt invoice analyzer or a custom document analyzer.
What defines the fields and their types in a custom analyzer? The field schema.
After POSTing to the analyze endpoint you get HTTP 202. How do you get the result? Poll the URL in the Operation-Location response header until the status is Succeeded.
Which field method would you use for “ExpenseCategory: travel, IT, office or other”? Classify.
Which Content Understanding output helps you find a moment in a long training video? Video segments with timestamps, key frames and the transcript (plus any custom fields such as chapter titles).
Created by Ajeetkumar