Many of my clients still rely on highly unproductive processes for handling invoices. Large shared mailboxes are flooded daily with PDF files, which are manually processed by different employees.
Today, there are far more efficient ways to handle this: with Document Intelligence and Logic Apps on Azure, invoice processing can be fully automated – from receiving the email to delivering data to ERP systems like SAP.
Our Use Case
In our scenario, we receive a regular email with an invoice attached. A Logic App is triggered automatically, sending the PDF attachment via an API to Document Intelligence. The invoice is analyzed, and the results are returned to the Logic App.
From there, the output can be routed as needed, for example, into SAP or other systems via APIs.
Prerequisites for This Example
To follow along, you’ll need:
- An active Azure subscription
- Document Intelligence via AI Foundry (Azure resource)
- A Logic App (Azure resource)
- A sample mailbox
Step-by-Step Guide
Create a Document Intelligence Resource
Log in to the Azure portal and navigate to AI Foundry. Select the Document Intelligence service and create a new resource. Subscription, resource group, and name are your choice
The Free Tier is sufficient for initial tests


Once the resource is created, open it and copy the Key and Endpoint URL from the Keys and Endpoint section. You will need these later in the Logic App.

Create the Logic App
Open the Logic App dashboard and create a new resource (we use the Consumption plan). Region, name, and other settings are flexible. Direct link to create Logic App

Configure the Trigger
In the Logic App Designer, select the trigger: “When a new email arrives (v3)” Optional: add a subject filter, e.g., INVOICECHECK, so the flow only triggers for invoice emails

Capture the Attachment
Add the action “Get Attachment”. Parameters: MessageID and AttachmentID from the trigger Logic App automatically wraps this in a Foreach loop, in case there are multiple attachments

Analyze the Document
Choose the action “Analyze Document for Prebuilt or Custom Models”. Use the Account Key and Endpoint URL from step 1 (for authentication) Pass the Model Identifier and the attachment content from the previous step


The output of the result initially appears as a long and opaque JSON. However, most of it can safely be ignored. The important part lies under “Fields”. Thanks to the prebuilt model, you will always find the following values there:
- CustomerAddress
- CustomerAddressRecipient
- CustomerName
- InvoiceID
- InvoiceTotal
- Items
- PaymentDetails
- VendorAddress
- VendorAddressRecipient
- VendorName

When you parse this JSON-Output, you can select every single value und proceed with it whatever you want.
Have fun!


