Azure setup
Document Intelligence
Provision the F0 Document Intelligence resource with the CLI, fetch the endpoint and key, and analyze a first invoice in the Studio.
By the end of this stage the second Azure service is live. A free-tier Document Intelligence resource exists in your resource group, you know its endpoint and key, and you have analyzed a first invoice and seen typed fields with confidence scores come back.
daveebbelaar/invoice-review0:19:09What Document Intelligence is
Azure AI Document Intelligence is a document extraction service with prebuilt models for common document types. This project uses two of them. prebuilt-invoice returns invoice-specific fields such as supplier, invoice ID, dates, totals, currency, and line items. prebuilt-receipt does the same for receipts, with merchant and transaction fields instead.
The important property is that these are purpose-built extraction models. They return semantic field names with confidence values per field, and they were trained on enormous volumes of real documents. That makes Document Intelligence the primary extractor in this project, with the general-purpose LLM in a supporting role.
Provision it from the CLI
Create the resource in the existing group. One historical quirk to know about, the CLI still uses the service's old product name FormRecognizer as the kind:
az cognitiveservices account create \
--name di-invoice-review \
--resource-group rg-invoice-review \
--kind FormRecognizer \
--sku F0 \
--location westeurope \
--yes \
--output tableThe resource name becomes part of a DNS hostname, so it must be unique. If creation fails on the name, add your own suffix, for example di-invoice-review-7314.
--sku F0 is the free tier, and it is genuinely useful rather than a token gesture. F0 processes 500 pages per month at no cost, limited to the first two pages per request, 4 MB per file, and one request per second. There is no paid overage; when the quota is spent you either wait for the monthly reset or move to the paid S0 tier ($10 per 1,000 prebuilt pages). This project fits comfortably inside the free allowance.
Fetch the endpoint and key. These are the values the backend will need during the build, and you can run these commands again at any time:
az cognitiveservices account show \
--name di-invoice-review \
--resource-group rg-invoice-review \
--query properties.endpoint \
--output tsv
az cognitiveservices account keys list \
--name di-invoice-review \
--resource-group rg-invoice-review \
--query key1 \
--output tsvKeys are secrets
The key authorizes billing against your resource. During the build it only ever lives in a gitignored .env file, never in code and never in a commit.
Analyze a first invoice
Document Intelligence Studio is the browser playground for the service. Open it, pick the invoice model, and analyze a document. Microsoft's sample invoice is perfect for a first run, or grab one of the fictional invoices from the samples/ folder in the project repo.
The Studio shows the raw fields with bounding boxes on the document and a confidence value per field, which is the best way to see what the service actually reads. Click through a few fields and look at the confidence numbers. Building intuition for this output matters, because deciding what the application does with these fields, and with the confidence scores, is a core part of the build.
Setup complete
Both Azure services are now live in rg-invoice-review, and you have tested each one by hand. That is the whole foundation. From here the build starts. The extraction pipeline, the business rules, the backend, and the review interface all get built from the main branch of the starter repo, stage by stage, through the sections that follow.
Checkpoint
az cognitiveservices account showreports a ready endpoint- You can fetch the endpoint and key from the CLI
- You have analyzed an invoice in Document Intelligence Studio and inspected the per-field confidence scores