An Azure service that turns documents into usable data. Previously known as Azure Form Recognizer.
Hello Le Duy Khanh,
The Azure AI Document Intelligence connector (previously Form Recognizer) is still available in Power Automate, but it's listed under the new name "Azure AI Document Intelligence (form recognizer)"—search for that exactly in the connectors panel, or look under AI Builder > Document processing for prebuilt options. For custom models like yours (trained for PDF extraction and comparison), the built-in connector supports model IDs, but if it's not appearing or failing, the easiest integration is via HTTP actions calling the REST API directly—no extra custom connector needed. This works seamlessly with Power Automate's premium license and lets you pull extracted data for comparison against your OneDrive standard file, then email results (Pass/Fail).
Step 1: Verify/Find the Connector
- In Power Automate > Create flow > Search "Azure AI Document Intelligence" or "Form Recognizer"—if missing, ensure your environment has AI Builder enabled (Admin center > Environments > Your env > Settings > Features > AI Builder > Turn on).
- If still not there: Use the HTTP action (premium) for API calls—more flexible for custom models anyway.
Step 2: Set Up Your Flow for Custom Model Integration
Create an instant/manual cloud flow or trigger on file upload (e.g., "When a file is created in OneDrive/SharePoint").
- Get Document Intelligence Resource Details:
- In Azure portal > Your Document Intelligence resource > Keys and Endpoint > Copy Key 1 and Endpoint (e.g., https://your-region.cognitiveservices.azure.com/).
- Note your custom model ID from Document Intelligence Studio (Models tab > Copy ID, e.g., "custom-model-123").
- Add HTTP Action for Analyze (Extract Data from PDF):
- Add action: HTTP (premium connector).
- Method: POST
- URI:
{endpoint}/documentintelligence/documentModels/{modelId}:analyze?api-version=2024-07-31-preview- Replace {endpoint} with yours, {modelId} with custom model ID.
- Headers:
Ocp-Apim-Subscription-Key: {your-key} Content-Type: application/json - Body (for PDF file from OneDrive/SharePoint):
{ "urlSource": "https://your-onedrive-link-to-pdf.pdf" }- Or for file content: Use "base64Source" with file bytes (get via "Get file content" action first).
- This starts async analysis—response gives Operation-Location header with poll URL.
- Poll for Results:
- Add Compose action:
outputs('HTTP')?['headers']?['Operation-Location'](gets poll URL). - Add Do until loop: Condition:
body('HTTP_2')?['status']equals "succeeded" (limit 60 iterations, 10s delay).- Inside loop: HTTP action to poll URL (GET method, same key header).
- Parse JSON on response: Schema from sample (include "analyzeResult" with fields like your custom extractions).
- Output: Extracted data in
body('HTTP_2')?['analyzeResult']?['documents'][0]?['fields'].
- Add Compose action:
- Compare to Standard File:
- Add Get file content from OneDrive (your standard PDF).
- Use HTTP again to analyze the standard with same model (repeat Steps 2-3).
- Compare: Use Compose or condition—e.g., for key fields like "Amount" or "Date":
equals(outputs('Extracted_Amount'), outputs('Standard_Amount'))- For complex comparison (e.g., tolerance): Use expressions like
float(outputs('Extracted'))vs.float(outputs('Standard'))withgreaterOrEquals.
- For complex comparison (e.g., tolerance): Use expressions like
- Set variable: Pass/Fail based on matches (e.g., if all critical fields match: "Pass").
- Send Email Results:
- Add Send an email (V2) (Outlook/Office 365 connector).
- Body: "PDF Analysis: [Pass/Fail]. Differences: [list mismatches]. Attached: Original PDF."
- Attachments: Add the input PDF and extracted JSON (Compose as file).
Full Example Flow Structure
- Trigger: Manual or "When file created" (OneDrive/SharePoint).
- Get file content (input PDF bytes).
- HTTP (Analyze custom model)—Body:
{"base64Source": base64(body('Get_file_content'))}. - Compose (Poll URL from headers).
- Do until (Poll for success).
- Parse JSON (results schema).
- HTTP (Analyze standard file from OneDrive).
- Condition (Compare extracted fields).
- Send email (Results with attachments).
Tips for Success
- API Version: Use 2024-07-31-preview for custom models—supports better PDF handling.
- File Limits: Custom models handle up to 500 pages/500 MB; test with small PDFs first.
- Error Handling: Add scopes for "Try/Catch" (Compose with if(empty(extracted), "Error")).
- Costs: ~$1/1,000 pages (S0 tier); free F0 for testing (500 pages/month).
- Debug: In flow run history > Peek code > Test individual HTTP actions. If 404 on model, verify ID in Studio.
- Alternative if Stuck: Use AI Builder's "Document processing" model (train custom there)—native Power Automate action, no HTTP needed, but less flexible than Azure.
This API method is reliable and free-form—run a test flow with your model ID for quick validation. If auth/key issues pop up, share error details for tweaks.
Best Regards,
Jerald Felix