
Azure Document IntelligenceAuthorCloudBrum editorial teamCreatedLast reviewedReading time~17 minLevelBeginner to advanced
Microsoft Azure · Foundry Tools · Document extraction
Azure Document Intelligence extracts text, page structure and named fields from business documents. Start with a prebuilt model when the document fits a known category, such as an invoice; use Layout when you need the arrangement of content. A custom extraction model is worth considering when your own fields are missing from the prebuilt result. Microsoft previously called the product Azure AI Document Intelligence and Form Recognizer. The resource kind still uses that older name, which matters when you provision it.
On this page (17 sections)
Mind map: Azure Document Intelligence at a glance
Free to share. The downloaded image includes the CloudBrum link.
Key features (summary)
- Read and Layout serve different outputsRead supplies OCR text. Layout adds document structure such as tables, paragraphs and selection marks. Decide whether the next system needs plain text, reading order or field values before choosing a model.
- Prebuilt document modelsInvoice and receipt models name business fields for you. An invoice result can contain vendor details, tax and line items, but a missing field is still a possible outcome, not an invitation to fill it with a guess.
- Custom extraction and classificationTrain extraction for your document families, or classify documents before routing them to an extractor. Separate the routing score from the confidence of a value found inside the selected document.
- Long-running analysis operationsAn analyze call starts work and returns an operation location. The SDK poller follows that operation until a result is ready; repeatedly starting analysis is a different action and can create duplicate work.
- Identity-based accessMicrosoft Entra credentials work with a custom-subdomain endpoint. Assign the caller a suitable data-plane role and verify that networking permits the request. A management-plane subscription role alone is not the whole access path.
- Versioned APIs and modelsThe current stable API is v4.0, dated 2024-11-30. Keep your endpoint, client library and model assumptions together when upgrading; the old Form Recognizer name does not tell you which response schema your application receives.
Basic concepts
- Resource, endpoint and model ID
- The Azure resource is the access and billing boundary. Its endpoint receives the request, and a model ID such as prebuilt-invoice selects the extraction task. Creating the resource does not train a custom model.
- Content, spans and polygons
- The result contains document text alongside references to positions in that text and on the page. Preserve those references if reviewers need to trace a disputed value to the scan.
- Typed document fields
- Fields can carry a date, currency, number, array or object. Read the typed property where it exists instead of treating every displayed string as a ready-to-import accounting value.
- Confidence and validation
- Field confidence is on a zero-to-one scale. Your acceptance rules also need required fields, allowed currencies and business checks; the confidence number does not perform those checks for you.
- Free tier versus complete-document testing
- F0 processes only the first two pages of an analyze request. A successful response from F0 cannot demonstrate that page five of the same document will extract correctly.
- Document Intelligence and Content Understanding
- Microsoft documents Document Intelligence within Foundry Tools and alongside Content Understanding. Their workflows and APIs differ. Evaluate the output you need rather than swapping product names in an existing endpoint URL.
How to create & configure it
Try an invoice model before building a custom extractor
- Define a usable invoice recordWrite down the fields the receiving system requires, including currency and supplier reference. Include examples with multiple tax lines and documents that are credit notes rather than ordinary invoices.
- Provision a resource with a custom subdomainChoose a supported Region and a unique resource name. Use the custom-subdomain endpoint for Entra authentication; the deployment kind remains FormRecognizer even though the public product name changed.
- Authorize the application identityGive the workload the documented analysis role at the resource scope. Start with Cognitive Services User for the analysis example, and test with the actual managed identity rather than assuming a developer login proves the production role works.
- Submit synthetic invoices to prebuilt-invoiceBegin with a small PDF through API 2024-11-30. Keep the operation reference so a timeout can be investigated without submitting the same file again. Use S0 when testing pages beyond F0’s two-page limit.
- Inspect missing fields as well as good answersCompare the result with your expected record. Review documents with no InvoiceTotal, several candidate documents, an absent currency code or a low-confidence required value. A blank extraction should remain blank until resolved.
- Release the mapping, then monitor itVersion the conversion from model fields into your application schema. Track corrections by supplier and document format so a new invoice layout does not disappear inside an overall average.
Keep training examples separate from the documents used to judge a custom model. A model that remembers familiar layouts can look useful in the studio while still creating work for reviewers on new suppliers.
Common issues after configuration
| Symptom | Likely cause | What to check / fix |
|---|---|---|
| Only two pages appear in the output | The resource uses the F0 tier | Check the SKU before debugging the parser. F0 deliberately limits analysis to the first two pages, even when the uploaded file contains more. |
| 401 or 403 from an Entra-based client | The token, endpoint or resource-scoped role is wrong | Use a custom subdomain, request the Cognitive Services audience and confirm the workload identity has the analysis data-plane role. Check network rules separately from role assignments. |
| 429 while analysis is running | Analyze and result-retrieval limits are being exceeded | Limit submissions and polling independently. Keep the SDK retry policy, add queue backpressure and avoid a loop that restarts analysis after each throttled poll. |
| Unsupported media, excessive pages or invalid content | The chosen model or tier does not accept the input | The documented general S0 limits are 500 MB and 2,000 pages, versus 4 MB and two pages for F0. Model-specific and format restrictions still apply; a general resource limit does not promise every model accepts every file. |
| A previously working client gets version errors | An older API or SDK is still in use | Check the actual API version on requests. Microsoft lists v2.1 retirement in September 2027 and v3.0 retirement in March 2029; use the current v4.0 migration guidance rather than inferring support from an old tutorial. |
| Line items import with the wrong types | The application flattened nested Items fields or parsed a localized amount as plain text | Preserve array/object boundaries and currency metadata. Test commas, decimal separators and missing cells before the output reaches an import job. |
Use cases: when and where to use it
Good fit
- Invoice processing that needs named fields and a review step before posting.
- Recovering tables and paragraphs for a document search pipeline.
- Forms from recurring business partners where custom extraction has measurable value.
- Classifying mixed inputs before sending each document to the right model.
Consider something else
- Native digital records already provide structured fields: accept those fields instead of recognizing their printed copy.
- An app needs a fraud or payment decision: use extraction as an input to that decision, with separate controls.
- A model cannot be validated on your required language or document type: compare another extractor rather than hiding the failures.
- The task requires multimodal or generative interpretation: assess Content Understanding separately and compare its contracts and output.
Pros: why consider it?
Why teams choose it
- Prebuilt models let a team test useful business fields before investing in labeling.
- Typed results reduce some of the parsing work that plain OCR leaves to the application.
- Entra authentication can fit an Azure workload identity without distributing a service key.
- The studio helps a reviewer examine a field beside its source, which is more useful than a detached JSON value.
Trade-offs to weigh
- A studio demonstration does not establish the error rate for a whole document population.
- The free tier can conceal failures on later pages if you forget its processing limit.
- Model and API upgrades need tests for the application mapping, not only a successful HTTP response.
- Custom classification and extraction can introduce separate training, operation and maintenance work.
Common threats, vulnerabilities & risks
| Risk | Severity | Why it matters | Mitigation |
|---|---|---|---|
| An uncertain field becomes a financial record | High | A plausible result can still select the wrong total or miss an invoice adjustment. | Keep payment approval outside the extractor and reconcile the fields required by the receiving system. |
| Document contents spread through diagnostics | High | Debug logs and support exports can retain sensitive fields longer than the original file. | Use operation identifiers and error categories in routine logs; protect raw responses and review exports with their own retention rules. |
| A custom model is judged on its training set | Medium | The measured result overstates how the model handles unseen layouts. | Reserve independent test documents and review errors by document family. |
| Version drift changes downstream behavior | Medium | A field can be omitted or represented differently after a service or mapping change. | Pin the stable API and application mapping, then compare a fixed regression set before an upgrade. |
| Network hardening locks out the application | Medium | Disabling public access before private DNS and routes work breaks extraction. | Test the private endpoint from the workload subnet before turning off the public path. |
| Documents instruct a later AI agent to take action | Medium | Text recovered from an uploaded file is still controlled by its author. | Separate document content from trusted instructions and approve any consequential tool action outside the model. |
Performance optimisation
- Time the full operation, including the wait for analysis and the application mapping.
- Keep the identity token cache supplied by the credential library instead of requesting a new token for each page.
- Scale result polling separately from document intake so faster uploads do not create a polling storm.
- Use a page range only when the workflow can legitimately ignore the omitted pages.
- Keep the source image readable; reducing upload bytes is not useful if a faint invoice number is lost.
- Benchmark each selected model and document family rather than assuming the invoice timing describes custom classification.
Reduce monthly cost
The useful unit of cost is a checked document record. Compare what the service processed with what the application could actually accept, then look at the work left in the review queue.
- Use Read when OCR is sufficient; choose Layout or a document-specific model for a reason you can measure.
- Estimate pages by model and optional feature, then compare the available commitment plan with your sustained volume.
- Remember completed operation results using a document/version key so replayed intake events do not trigger unnecessary analysis.
- Count reviewer minutes and corrections alongside the service usage metric.
- Separate custom model experiments from the production resource budget and clean up obsolete training artifacts.
- Review the price of optional analysis features before enabling the same set for every input.
F0 is a convenient start, but its two-page behavior is not a cheaper way to validate a long-document workflow. Test the pages your production process will depend on.
Security optimisation
- Prefer a managed workload identity and scope its role to the specific Document Intelligence resource.
- Disable local-key authentication only after the Entra path has been verified for every caller that still needs access.
- Use private networking where required, including a working DNS configuration for the endpoint.
- Treat a storage identity used by the service and the identity calling the analysis API as different principals with different permissions.
- Keep temporary outputs, labeled samples and reviewer downloads inside the same data-handling review as the source records.
- Use synthetic files in public bug reports and code examples; remove real customer and employee details.
Governance & compliance
Guardrails
- Document the approved models, API version, Region and identity for the intake workflow.
- Assign a business owner to exceptions and to the field mapping used by the receiving system.
- Require evidence on unseen documents before changing a custom model or a confidence rule.
Ongoing evidence
- Review missing required fields and corrected amounts by supplier.
- Alert on long-running operations, 401/403 responses and sustained 429 rates.
- Retest role assignments, private endpoint access and document deletion at regular intervals.
Choose a Region and service configuration that meet the organization’s requirements, then confirm the relevant Microsoft compliance scope. A compliant cloud offering does not approve your retention policy, document access or treatment of review errors.
Reduce carbon footprint
- Reuse an existing valid analysis result when the document and extraction settings have not changed.
- Avoid running several models on every file when a measured routing step can choose the right task.
- Remove obsolete training copies and expired review exports according to the approved retention schedule.
- Do not infer an emissions-per-invoice number from an Azure account-wide estimate; the measurement boundaries are different.
Pricing
Purchase options
Read and Layout Page-based models
These models have their own rates and supported options. Check whether the intended output needs Layout rather than plain OCR.
Prebuilt extraction By model and pages
Invoice and other business-document models are priced by the applicable operation, not by the number of populated fields.
Custom work Training and analysis terms
Custom extraction and classification have their own metering rules. Include experiments as well as the eventual production calls.
F0 and commitment plans Check current eligibility
F0 is limited and intended for evaluation. Larger steady workloads may suit a commitment plan after their real page mix is understood.
What you actually pay for
- Pages submitted to each model, with the applicable feature charges.
- Eligible custom training or classification usage under the current pricing terms.
- Storage, queueing, networking and application compute around the analysis call.
- Manual checks, correction and investigation when a record cannot be accepted.
Use the official Azure Document Intelligence pricing page for the resource Region, model and current plan. This guide intentionally avoids freezing a dollar rate or promising a free allowance that may have changed.
Important code references
The setup tabs create an S0 analysis resource and authorize an existing application identity. They leave the public endpoint enabled for an initial authenticated test; configure private networking before production where required. The Python example submits a synthetic invoice and exports its typed result; C# checks the exported record without printing its values. These are building blocks, not an accounting approval system.
# Azure CLI signed in to your test subscription; replace both identifiers.
DOC_RG=document-intake-demo
DOC_REGION=eastus
DOC_NAME=replace-with-unique-document-account
DOC_PRINCIPAL=replace-with-workload-object-id
az group create --name "$DOC_RG" --location "$DOC_REGION"
az cognitiveservices account create --name "$DOC_NAME" --resource-group "$DOC_RG" \
--location "$DOC_REGION" --kind FormRecognizer --sku S0 --custom-domain "$DOC_NAME" --yes
DOC_ID=$(az cognitiveservices account show --name "$DOC_NAME" \
--resource-group "$DOC_RG" --query id --output tsv) || exit 1
az role assignment create --assignee-object-id "$DOC_PRINCIPAL" \
--assignee-principal-type ServicePrincipal --role "Cognitive Services User" --scope "$DOC_ID"
az cognitiveservices account show --name "$DOC_NAME" --resource-group "$DOC_RG" \
--query properties.endpoint --output tsv
# Use that custom-subdomain endpoint with the Python tab.
# After all callers use Entra, the following disables their old key path:
az resource update --ids "$DOC_ID" --set properties.disableLocalAuth=true
terraform {
required_providers {
azurerm = { source = "hashicorp/azurerm", version = "~> 4.0" }
}
}
provider "azurerm" { features {} }
variable "account_name" { type = string }
variable "analyzer_principal_id" { type = string }
resource "azurerm_resource_group" "docs" {
name = "document-intake-demo"
location = "East US"
}
resource "azurerm_cognitive_account" "docs" {
name = var.account_name
location = azurerm_resource_group.docs.location
resource_group_name = azurerm_resource_group.docs.name
kind = "FormRecognizer"
sku_name = "S0"
custom_subdomain_name = var.account_name
local_auth_enabled = false
public_network_access_enabled = true
tags = { owner = "platform", purpose = "document-intake" }
}
resource "azurerm_role_assignment" "analyze" {
scope = azurerm_cognitive_account.docs.id
role_definition_name = "Cognitive Services User"
principal_id = var.analyzer_principal_id
}
output "endpoint" { value = azurerm_cognitive_account.docs.endpoint }
# The principal must already exist. This is an authenticated public-endpoint demo.
# Add a private endpoint and DNS, test that path, then disable public access.
# pip install azure-ai-documentintelligence azure-identity
import json
import sys
from azure.ai.documentintelligence import DocumentIntelligenceClient
from azure.ai.documentintelligence.models import AnalyzeDocumentRequest
from azure.identity import DefaultAzureCredential
def review_reasons(result, min_confidence=0.95):
# Example review threshold only; calibrate it on your own labeled invoices.
documents = result.documents or []
if len(documents) != 1:
return ["expected_one_invoice"]
fields = documents[0].fields or {}
reasons = []
total = fields.get("InvoiceTotal")
if total is None or total.value_currency is None:
return ["missing_typed_total"]
if not total.value_currency.currency_code:
reasons.append("missing_currency")
if total.confidence is None or total.confidence < min_confidence:
reasons.append("review_total_confidence")
if "InvoiceId" not in fields:
reasons.append("missing_invoice_id")
return reasons
def analyze_invoice(client, pdf_bytes):
operation = client.begin_analyze_document(
"prebuilt-invoice", AnalyzeDocumentRequest(bytes_source=pdf_bytes)
)
# A timeout doesn't cancel Azure's operation. Recover its state before resubmitting.
return operation.result(timeout=180)
if __name__ == "__main__":
# python invoice.py https://NAME.cognitiveservices.azure.com/ invoice.pdf result.json
endpoint, input_path, output_path = sys.argv[1:]
with DefaultAzureCredential() as credential:
with DocumentIntelligenceClient(endpoint, credential, api_version="2024-11-30") as client:
with open(input_path, "rb") as source:
result = analyze_invoice(client, source.read())
with open(output_path, "x", encoding="utf-8") as target:
json.dump({"analyzeResult": result.as_dict()}, target, default=str)
reasons = review_reasons(result)
print("Review checks: " + (", ".join(reasons) if reasons else "continue remaining business checks"))
// .NET console app: dotnet run -- result.json
// Reads the Python export. It does not call Azure or approve an invoice.
using System.Text.Json;
using var json = JsonDocument.Parse(File.ReadAllText(args[0]));
if (!json.RootElement.TryGetProperty("analyzeResult", out var result) ||
!result.TryGetProperty("documents", out var docs) ||
docs.ValueKind != JsonValueKind.Array || docs.GetArrayLength() != 1)
{
Console.WriteLine("Review: expected exactly one invoice.");
return;
}
if (!docs[0].TryGetProperty("fields", out var fields) || fields.ValueKind != JsonValueKind.Object ||
!fields.TryGetProperty("InvoiceTotal", out var total) ||
!total.TryGetProperty("valueCurrency", out var money) ||
!money.TryGetProperty("amount", out var amount) || amount.ValueKind != JsonValueKind.Number)
{
Console.WriteLine("Review: no typed invoice total.");
return;
}
var reasons = new List<string>();
if (!money.TryGetProperty("currencyCode", out var currency) ||
string.IsNullOrWhiteSpace(currency.GetString())) reasons.Add("missing currency");
if (!total.TryGetProperty("confidence", out var confidence) || confidence.GetDouble() < 0.95)
reasons.Add("check total confidence");
if (!fields.TryGetProperty("InvoiceId", out _)) reasons.Add("missing invoice id");
Console.WriteLine(reasons.Count == 0
? "Candidate record: continue arithmetic, supplier and approval checks."
: "Review: " + string.Join(", ", reasons));
// The 0.95 example is not a universal threshold. Keep raw values out of routine logs.
Best videos to explore
These official Microsoft Learn episodes use the earlier Form Recognizer name. They explain the concepts; use the current v4.0 documentation and examples for implementation. The links open the original video pages without loading a player into this article.
Interview questions
BasicWhat does Azure Document Intelligence do?
It extracts document text and structure, and can return named fields through prebuilt or custom models. A business application still decides which fields are required and how uncertain results are reviewed.
BasicIs Document Intelligence the same as Form Recognizer?
Form Recognizer and Azure AI Document Intelligence are earlier product names. Microsoft now documents Azure Document Intelligence in Foundry Tools. The resource kind remains FormRecognizer, so current deployment commands can legitimately contain the old name.
BasicWhich model should I try for invoices?
Try prebuilt-invoice against representative invoices and compare its typed fields with your expected record. Check line items, currency and missing values as well as a few clean totals before deciding whether custom extraction is needed.
IntermediateWhen should I use Read instead of Layout?
Use Read to recover printed and handwritten text. Choose Layout when the application needs document organization such as tables and paragraphs. Review the supported features and costs of your API version before enabling additional output options.
IntermediateWhy does my long PDF produce only two pages?
A resource on F0 returns analysis for only the first two pages. Confirm the SKU before treating that response as a service defect. Use the appropriate paid configuration to evaluate a complete production-length document.
IntermediateHow do I use Microsoft Entra authentication?
Use a custom-subdomain endpoint, a credential for the intended workload identity and the documented data-plane role at the resource scope. Verify network access and role propagation too. The Python example uses DefaultAzureCredential rather than storing a service key.
IntermediateCan I trust a field with confidence 0.99?
The number describes the extraction result, not whether it is the right business value. Check required fields and accounting rules, compare errors on labeled examples and decide review thresholds according to the consequences of a mistake.
IntermediateCan Document Intelligence classify and extract custom forms?
Yes. Custom classification routes document types, while custom extraction targets fields for your own document families. Keep independent test data and measure both routing mistakes and field-level errors.
AdvancedWhat should happen when the SDK poller times out?
Keep the operation reference and inspect whether the analysis is still running or already complete. A local wait timeout does not prove the server stopped. Starting a replacement request immediately can duplicate processing and cost.
AdvancedWhich API version does this guide use?
The examples use v4.0, dated 2024-11-30. Microsoft currently lists retirement dates for older generations, including v2.1 in September 2027 and v3.0 in March 2029. Check the current version-support table before migrating an existing client.
AdvancedHow is Document Intelligence different from Content Understanding?
They expose different analysis workflows and APIs. Document Intelligence focuses on task-specific OCR and structured document extraction; Content Understanding also addresses generative and multimodal analysis. Compare required output, evaluation results and data handling before choosing.
AdvancedWhat are the AWS and Google Cloud alternatives?
Amazon Textract and Google Cloud Document AI can cover many of the same document-intake tasks. Test the required fields, language and document lengths on each service; model availability and the effort to review errors affect the result as much as the headline page price.
Similar or alternative services on other clouds
| Capability | AWS | Azure | Google Cloud |
|---|---|---|---|
| Service | Amazon Textract | Azure Document Intelligence | Google Cloud Document AI |
| Task selection | Core API and feature types | Model IDs select the Azure extraction task | A processor type and processor version |
| Invoice output | AnalyzeExpense fields and line items | prebuilt-invoice typed fields and Items | Invoice Parser returns entities with normalization |
| Customization | Custom Queries adapters | Custom extraction and classification | Custom Extractor and supported uptraining |
| Integration | Block graph and job pagination | Long-running operations and typed result mapping | Regional processor calls and Document objects |
| Evaluation | Required fields, errors and review effort | Judge unseen suppliers and complete document lengths | Measure the same task with the selected processor version |
Related Azure building blocks include Blob Storage for source documents and Azure Functions for short processing steps. Keep document extraction separate from Azure AI Vision, which addresses a different set of image-analysis tasks.
Did you find this article helpful?
Your answer helps us improve this page for the next reader.
Sources and further reading
CloudBrum wrote this page in its own words, using the provider’s public documentation listed below as the reference. Features, limits, names and prices change, so confirm anything that matters on the provider’s own pages before you decide.
- Document Intelligence overview and version supportMicrosoft Learn
- Layout modelMicrosoft Learn
- Invoice model and fieldsMicrosoft Learn
- Service limits and free-tier behaviorMicrosoft Learn
- Create a Document Intelligence resourceMicrosoft Learn
- Python SDK and authenticationMicrosoft Learn
- Azure Document Intelligence pricingMicrosoft Azure
