Working with document intelligence often starts with a simple requirement: take a file, understand its contents, extract useful information, and make the result available to an application.
That sounds straightforward until the input contains different document types, tables, images, handwritten content, or semi-structured information.
Microsoft Azure Content Understanding provides capabilities for analyzing content across documents and other media. For developers, however, testing analyzers through a graphical interface is not always the most convenient approach. When an analyzer is part of a development or automation workflow, being able to invoke it directly from the command line can make testing much easier.
The Azure Content Understanding CLI provides a developer-friendly way to work with Content Understanding resources and test document analysis from a terminal.
This article walks through a practical command-line workflow, explains where the CLI fits into an application architecture, and shows how developers can use it to validate analyzers before integrating them into an application.
What Is Azure Content Understanding?
Azure Content Understanding is designed to extract structured information from content such as documents, images, audio, and video.
For document workloads, the general workflow looks like this:
Document
|
v
Content Understanding Analyzer
|
v
Content Extraction
|
+---- Text
+---- Tables
+---- Fields
+---- Layout
+---- Structured Output
Instead of writing a separate parser for every document format, developers can use an analyzer to process the input and return structured information.
Typical scenarios include:
Invoice processing
Contract analysis
Form extraction
Resume parsing
Document classification
Business document processing
Knowledge extraction
RAG document preparation
The CLI becomes useful when you want to test these operations quickly without writing application code for every experiment.
Why Use a CLI for Document Analyzer Testing?
A graphical interface is useful for exploring a service, but command-line tools provide several advantages for developers.
Faster Iteration
You can run an analyzer repeatedly against different files without rebuilding an application.
document-a.pdf
document-b.pdf
document-c.pdf
This is useful when tuning an analyzer or validating a document set.
Easy Automation
CLI commands can be incorporated into scripts and CI/CD pipelines.
Build
|
v
Deploy Analyzer Configuration
|
v
Run Test Documents
|
v
Validate Results
Easier Reproduction
A command can be copied into a ticket, script, or troubleshooting document.
Instead of saying:
Upload the document, select the analyzer, choose these settings...
you can provide a reproducible command.
Better Developer Workflow
Developers already use terminals for Azure CLI, Git, package managers, and deployment tools. Adding Content Understanding operations to the same workflow reduces context switching.
Installing the Required CLI Tooling
Before using the Content Understanding CLI, make sure the required Azure tooling and authentication are available on the development machine.
A typical environment includes:
Operating System
|
+---- Azure CLI
|
+---- Content Understanding CLI
|
+---- Azure subscription
|
+---- Content Understanding resource
Verify the Azure CLI installation:
az --version
Then authenticate:
az login
For development environments that use multiple Azure subscriptions, check the active subscription:
az account show
If necessary, select the required subscription:
az account set --subscription "<subscription-name-or-id>"
Authentication should use the least-privileged identity required for the operation.
Understanding the Analyzer Workflow
An analyzer defines how Content Understanding should interpret incoming content.
At a high level:
Input
|
v
Analyzer
|
+---- Content Extraction
|
+---- Field Extraction
|
+---- Classification
|
v
Structured Result
For example, an invoice analyzer might identify:
Invoice Number
Vendor Name
Invoice Date
Subtotal
Tax
Total
Line Items
The exact schema depends on the analyzer configuration and the document-processing scenario.
The CLI allows developers to exercise this workflow without first implementing a complete SDK-based application.
Running an Analyzer from the Command Line
The exact CLI command depends on the installed version and the Content Understanding CLI command surface.
A typical workflow conceptually looks like:
az <content-understanding-command> analyzer analyze \
--resource-group "<resource-group>" \
--account-name "<resource-name>" \
--analyzer-id "<analyzer-id>" \
--input "<document-path>"
The important parameters are:
Parameter | Purpose |
|---|---|
Resource group | Identifies the Azure resource group |
Resource name | Identifies the Content Understanding resource |
Analyzer ID | Selects the analyzer |
Input | Specifies the document to analyze |
Because CLI syntax can evolve, developers should use the help command provided by their installed CLI version before putting a command into automation.
For example:
az <content-understanding-command> --help
This is particularly important for preview CLI functionality.
Testing a Local Document
Suppose you have an invoice:
samples/
└── invoice-001.pdf
The first useful test is to submit that document to the analyzer.
az <content-understanding-command> analyzer analyze \
--analyzer-id "invoice-analyzer" \
--input "./samples/invoice-001.pdf"
The returned result can then be inspected to determine whether the analyzer extracted the expected information.
A simplified result might resemble:
{
"invoiceNumber": "INV-1001",
"vendorName": "Contoso",
"invoiceDate": "2026-09-10",
"total": 1250.00
}
The actual response schema depends on the analyzer definition.
Save the Result for Comparison
When testing analyzers, saving the output is often more useful than simply displaying it.
For example:
az <content-understanding-command> analyzer analyze \
--analyzer-id "invoice-analyzer" \
--input "./samples/invoice-001.pdf" \
> result.json
Now the output can be compared with another analyzer version.
result-v1.json
result-v2.json
This is particularly useful when modifying field definitions or analyzer configurations.
Testing Multiple Documents
One of the biggest advantages of command-line workflows is repeatability.
A shell script can process a directory of test documents.
For example:
for file in ./samples/*.pdf
do
echo "Processing $file"
az <content-understanding-command> analyzer analyze \
--analyzer-id "invoice-analyzer" \
--input "$file" \
> "./results/$(basename "$file").json"
done
The exact CLI command should be replaced with the syntax supported by the installed Content Understanding CLI version.
The important pattern is:
Test Documents
|
v
CLI Loop
|
v
Analyzer
|
v
JSON Results
This turns manual testing into a repeatable test process.
Validate Extracted Fields
Running the analyzer is only half the job.
You also need to validate the result.
Suppose the expected invoice fields are:
{
"invoiceNumber": "INV-1001",
"vendorName": "Contoso",
"total": 1250.00
}
Join the conversation! Your thoughts help the community grow.