OneDrive /HomHITH-Dev/01-Input
│ (Power Automate trigger: When a file is created)
▼
Power Automate Dev Flow (VortexSurveillance tenant)
│ HTTP POST (base64 file content + metadata)
▼
Azure Function func-homehith-dev (Python 3.11, Consumption)
│
├─ SHA-256 hash check → skip if duplicate
├─ Azure AI Document Intelligence doc-intel-homehith-dev (prebuilt-read OCR)
├─ INSERT → SQL: Documents table (local: DAVID-HP\MSSQLDEVSERVER)
├─ Chunk text → INSERT → SQL: DocumentChunks table
└─ Return JSON result to Power Automate
│
├─ status: processed → move to /02-Output/Processed
└─ status: error → move to /02-Output/Failed + email alert
Sign in to portal.azure.com with your VortexSurveillance account.
Resource Groups → + Create
| Field | Value |
|---|---|
| Subscription | (your VortexSurveillance subscription) |
| Resource group | rg-homehith-dev |
| Region | Australia East |
Storage accounts → + Create
| Field | Value |
|---|---|
| Resource group | rg-homehith-dev |
| Name | sthomehithdev (lowercase, globally unique) |
| Region | Australia East |
| Redundancy | LRS (cheapest for dev) |
After creation: Access keys → key1 → Connection string — copy it.
Cognitive Services → Document Intelligence → + Create
| Field | Value |
|---|---|
| Resource group | rg-homehith-dev |
| Name | doc-intel-homehith-dev |
| Region | Australia East |
| Pricing tier | F0 (free — 500 pages/month) |
After creation: Keys and Endpoint — copy Key 1 and Endpoint URL.
Function App → + Create
| Field | Value |
|---|---|
| Resource group | rg-homehith-dev |
| Function App name | func-homehith-dev (globally unique) |
| Runtime stack | Python |
| Version | 3.11 |
| Region | Australia East |
| Hosting plan | Consumption (Serverless) |
| Storage account | sthomehithdev |
Microsoft Entra ID → App registrations → + New registration
| Field | Value |
|---|---|
| Name | HomeHITH-FunctionApp-dev |
| Supported account types | Accounts in this org directory only |
| Redirect URI | (leave blank) |
After registering, note the Application (client) ID → referred to as <dev-client-id> below.
Certificates & secrets → + New client secret
| Field | Value |
|---|---|
| Description | dev-caller |
| Expires | 24 months |
Copy the Value immediately — it is shown only once.
Expose an API → Set (accept default api://<dev-client-id>)
+ Add a scope:
| Field | Value |
|---|---|
| Scope name | process-document |
| Who can consent | Admins only |
| Admin consent display name | Process Home+HITH Documents (dev) |
| State | Enabled |
func-homehith-dev → Authentication → + Add identity provider
| Field | Value |
|---|---|
| Identity provider | Microsoft |
| App registration type | Provide existing app registration details |
| Application (client) ID | <dev-client-id> |
| Client secret | (from Phase 2) |
| Issuer URL | https://login.microsoftonline.com/24528d2a-bbba-4be5-8de3-1bb70cb01654/v2.0 |
| Unauthenticated requests | HTTP 401 Unauthorized |
func-homehith-dev → Configuration → Application settings → + New application setting
| Setting Name | Value |
|---|---|
SQL_CONNECTION_STRING | DRIVER={ODBC Driver 17 for SQL Server};SERVER=DAVID-HP\MSSQLDEVSERVER;DATABASE=HomeHITH;Trusted_Connection=yes; |
DOCUMENT_INTELLIGENCE_ENDPOINT | https://doc-intel-homehith-dev.cognitiveservices.azure.com/ |
DOCUMENT_INTELLIGENCE_KEY | Key 1 from Phase 1.3 |
Click Save after adding all settings.
DAVID-HP\MSSQLDEVSERVER directly.
For local dev (func start), the local SQL connection works fine.
For remote testing from Azure, either expose the SQL port via a VPN / Azure Hybrid Connection,
or provision a free Azure SQL Serverless database in rg-homehith-dev.
File: Ingest/AzureFunction/local.settings.json
{
"IsEncrypted": false,
"Values": {
"AzureWebJobsStorage": "<sthomehithdev-connection-string>",
"FUNCTIONS_WORKER_RUNTIME": "python",
"SQL_CONNECTION_STRING": "DRIVER={ODBC Driver 17 for SQL Server};SERVER=DAVID-HP\\MSSQLDEVSERVER;DATABASE=HomeHITH;Trusted_Connection=yes;",
"DOCUMENT_INTELLIGENCE_ENDPOINT": "https://doc-intel-homehith-dev.cognitiveservices.azure.com/",
"DOCUMENT_INTELLIGENCE_KEY": "<key1-from-doc-intel-homehith-dev>"
}
}
Open a terminal in Ingest/AzureFunction/ and run:
# Authenticate to VortexSurveillance tenant az login --tenant 24528d2a-bbba-4be5-8de3-1bb70cb01654 # Deploy func azure functionapp publish func-homehith-dev --python
After deployment, retrieve the Function Key:
func-homehith-dev → Functions → process-document → Function Keys → default → Copy
HomeHITH Dev Test/HomHITH-Dev/01-InputID from trigger dynamic content| Field | Value |
|---|---|
| Method | POST |
| URI | https://func-homehith-dev.azurewebsites.net/api/process-document?code=<function-key> |
| Headers | Content-Type: application/json |
HTTP Body:
{
"filename": "@{triggerOutputs()?['body/Name']}",
"filecontent": "@{base64(body('Get_file_content'))}",
"uploaded_by": "dev@VortexSurveillance.onmicrosoft.com",
"document_type": "CFS"
}
{
"status": "processed",
"document_id": 42,
"chunks": 12,
"extraction_method": "AzureDocumentIntelligence"
}
body('Parse_JSON')?['status'] is equal to processed/HomHITH-Dev/02-Output/Processed/HomHITH-Dev/02-Output/Failed + send email alert/HomHITH-Dev/01-Input"status": "processed"DAVID-HP\MSSQLDEVSERVER → HomeHITH → Documents and DocumentChunks tables for new rows/02-Output/Processed| Placeholder | Where to get it |
|---|---|
<sthomehithdev-connection-string> | Storage account → Access keys → key1 → Connection string |
<key1-from-doc-intel-homehith-dev> | Document Intelligence → Keys and Endpoint → Key 1 |
<dev-client-id> | App registration → Overview → Application (client) ID |
<client-secret-value> | App registration → Certificates & secrets (copy immediately on creation) |
<function-key> | func-homehith-dev → Functions → process-document → Function Keys → default |
To save as PDF: File → Print → Destination: Save as PDF (or Microsoft Print to PDF) → Save