Introduction
Processing large volumes of documents manually is time-consuming and error-prone. Whether dealing with invoices, receipts, contracts, or business forms, extracting structured data efficiently is crucial for automation.
Azure Document Intelligence (formerly Azure Form Recognizer) is a cloud-based AI service that enables automated document processing using pre-trained and custom models. With just an API call, you can:
- ✅ Extract key-value pairs from structured forms.
- ✅ Process invoices, receipts, and business cards.
- ✅ Recognize handwritten text and printed text.
- ✅ Automate data extraction into databases or applications.
This article walks through setting up Azure Document Intelligence, sending a document for analysis, and visualizing extracted data.
![Azure service]()
1️⃣ Setting Up Azure Document Intelligence
Before sending documents for processing, you need to set up Azure Document Intelligence in the Azure Portal.
Steps to Create a Document Intelligence Resource
1️⃣ Log in to Azure Portal.
2️⃣ Click "Create a resource" → Search for "Document Intelligence".
3️⃣ Select "Cognitive Services → Document Intelligence".
4️⃣ Configure the details:
- Subscription: Select an active Azure subscription.
- Resource Group: Create or use an existing one.
- Region: Pick a region closest to your users.
- Pricing Tier: Choose "Standard" or "Free (F0)" for limited usage.
5️⃣ Click "Review + Create" → then "Create".
Once deployed, navigate to "Keys and Endpoint" in the Document Intelligence resource to get:
- ✔ API Key (used for authentication)
- ✔ Endpoint URL (base URL for sending API requests)
![Document Intelligence]()
2️⃣ Sending a Document to Azure Document Intelligence API
Now that the resource is set up, it's time to upload a document (PDF, image, or scanned document) for analysis.
Here’s a Python script to send a document to Azure Document Intelligence API:
📌 What’s Happening?
- The script uploads a document (PDF) to the API.
- The response returns an Operation-Location URL, which is needed to retrieve results later.
3️⃣ Retrieving & Parsing Extracted Data
After submitting a document, the API takes a few seconds to process it. The next step is retrieving the extracted data.
📌 What’s Happening?
- The script waits for processing to complete.
- It retrieves the extracted text in JSON format.
🔗 Azure Docs: Document Intelligence API Reference
4️⃣ Extracting Key Fields from Documents
The API returns structured data, which can be filtered for important key-value pairs such as invoice numbers, dates, and totals.
![Extracting key fields from documents]()
📌 Example Output
![Example output]()
5️⃣ Visualizing Extracted Data
To better understand extracted document data, you can visualize it in a table or chart.
Using Pandas to Display Data in a Table
6️⃣ Automating Document Processing Workflows
Once the extracted data is available, you can:
- ✅ Save it to a database for future reference.
- ✅ Integrate with Power Automate for real-time invoice processing.
- ✅ Use Azure Logic Apps to send automated email alerts.
For example, integrating Azure Logic Apps can send an email when an invoice total exceeds a threshold:
- 1️⃣ Go to Azure Logic Apps in Azure Portal.
- 2️⃣ Create a new Logic App → Choose a Trigger (e.g., "When a file is added to OneDrive").
- 3️⃣ Add an Action → Select "Send Email" (via Outlook, SendGrid, etc.).
- 4️⃣ Configure the email body with extracted invoice details.
- 5️⃣ Save and test the workflow.
🚀 Conclusion
Azure Document Intelligence simplifies automated document processing by extracting structured data from invoices, receipts, and contracts. With just an API call, you can:
- ✅ Convert scanned documents into structured data.
- ✅ Automate invoice processing and financial workflows.
- ✅ Integrate with databases, CRMs, and automation tools.
🔗 Further Learning