In this video, we explore how to set up document ingestion using the Retrieval-Augmented Generation (RAG) pattern with Azure Logic Apps.

This is greatly simplified with the addition of two new Data Operation Actions, Parse Document and Chunk Text, along with existing connectors to Azure AI Search and Azure OpenAI. These are all Actions that exist in Azure Logic Apps Standard Edition.

Starting from scratch, I will walk through the entire process, including setting up Azure OpenAI, Azure Search, and Azure Logic Apps—no prior AI or Logic Apps experience is required!

This video is designed to give you practical, hands-on experience with Azure’s Artificial Intelligence capabilities and Logic Apps so anyone can build on these skills for new projects and solutions.

Brand new to AI?  That is ok!  Check out my five video learning cheat sheet here.

Quick Link Download (see files below)s: 9-Step Task List  &  JSON Logic App

 

Watch for new content related to the Azure Integration Services, Azure Logic Apps, and Azure AI being created soon.

If you have any questions, feel free to reach out!

Task List
1. Create a new Resource Group: abc-aidemo-east
2. Create Logic App Standard: abc-logicapp-east
3. Create OpenAI Service and Set Models: abc-openai-east
Enable Managed Identity [Resource Management – Identity]
Get Endpoint: [Resource Management – Keys and Endpoint]
Go to OpenAI Studio
Create 2 models (do not think they need to be in the same region)
gpt-4
text-embedding-ada-002
4. Create AI Search – Basic: abc-aisearch-east
Note: Select Basic or higher to use Managed Identity.  Not tested on Free Tier.  
Note2: Must be in same region as Azure OpenAI Service.
Enable Managed Identity [Settings – Identity]
Enable API Access via Role-based access control [Settings – Keys]
Get Endpoint: [Overview]
Get Embedding Name:
5. Create Storage Account: abcstorewest
Create 2 Containers: search & input
Get Endpoint: [Settings – Endpoints – Blob service]
Permissions (Storage Account):
Logic App – Storage Blob Data Owner
AI Search- Storage Blob Data Reader
6. Set Permissions OpenAI Service: abc-openai-east
Permission: 
Logic App – Cognitive Services OpenAI Contributor
AI Search- Cognitive Services OpenAI Contributor
Your User Account – Cognitive Services OpenAI Contributor
7. Set Permissions AI Search – Basic: abc-aisearch-east
Permission: 
Logic App – Search Index Data Reader & Search Service Contributor & Search Index Data Contributor
OpenAI – Search Index Data Reader & Search Service Contributor
Import and Vector Data
8. Update Logic App
9. Go to Azure AI Studio Playground
 
Your Key Details Needed
Blob Connection: https://abcstoreeast.blob.core.windows.net/
Azure OpenAI Connection: https://abc-openai-east.openai.azure.com/
Azure OpenAI Embedding: text-embedding-ada-002
Azure Search Connection: https://abc-aisearch-east.search.windows.net

Process PDF Documents Logic App (just copy and paste into a new workflow)

{
    "definition": {
        "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
        "actions": {
            "For_each": {
                "type": "foreach",
                "foreach": "@outputs('List_all_the_blobs_using_path')?['body']?['blobs']",
                "actions": {
                    "Chunk_text": {
                        "type": "ChunkText",
                        "inputs": {
                            "chunkingStrategy": "TokenSize",
                            "text": "@body('Parse_a_document')?['text']",
                            "EncodingModel": "cl100k_base",
                            "PageOverlapLength": 0,
                            "TokenSize": 4096
                        },
                        "runAfter": {
                            "Parse_a_document": [
                                "SUCCEEDED"
                            ]
                        }
                    },
                    "Parse_a_document": {
                        "type": "ParseDocument",
                        "inputs": {
                            "content": "@body('Read_blob_content')?['content']"
                        },
                        "runAfter": {
                            "Read_blob_content": [
                                "SUCCEEDED"
                            ]
                        }
                    },
                    "Read_blob_content": {
                        "type": "ServiceProvider",
                        "inputs": {
                            "parameters": {
                                "containerName": "@items('For_each')?['containerName']",
                                "blobName": "@items('For_each')?['name']"
                            },
                            "serviceProviderConfiguration": {
                                "connectionName": "AzureBlob-1",
                                "operationId": "readBlob",
                                "serviceProviderId": "/serviceProviders/AzureBlob"
                            },
                            "retryPolicy": {
                                "type": "none"
                            }
                        }
                    },
                    "Get_multiple_embeddings": {
                        "type": "ServiceProvider",
                        "inputs": {
                            "parameters": {
                                "deploymentId": "text-embedding-ada-002",
                                "input": "@body('Chunk_text')?['value']"
                            },
                            "serviceProviderConfiguration": {
                                "connectionName": "openai-1",
                                "operationId": "getArrayEmbeddings",
                                "serviceProviderId": "/serviceProviders/openai"
                            },
                            "retryPolicy": {
                                "type": "none"
                            }
                        },
                        "runAfter": {
                            "Chunk_text": [
                                "SUCCEEDED"
                            ]
                        }
                    },
                    "Index_multiple_documents": {
                        "type": "ServiceProvider",
                        "inputs": {
                            "parameters": {
                                "indexName": "vector-1729738193967",
                                "documents": "@body('Select')"
                            },
                            "serviceProviderConfiguration": {
                                "connectionName": "azureaisearch-2",
                                "operationId": "indexDocuments",
                                "serviceProviderId": "/serviceProviders/azureaisearch"
                            },
                            "retryPolicy": {
                                "type": "none"
                            }
                        },
                        "runAfter": {
                            "Select": [
                                "SUCCEEDED"
                            ]
                        }
                    },
                    "Select": {
                        "type": "Select",
                        "inputs": {
                            "from": "@range(0, length(body('Chunk_text')['value']))",
                            "select": {
                                "chunk": "@body('Chunk_text')['value'][item()]",
                                "title": "@items('For_each')?['name']",
                                "text_vector": "@body('Get_multiple_embeddings')['embeddings'][item()]",
                                "chunk_id": "@guid()",
                                "parent_id": "@guid()"
                            }
                        },
                        "runAfter": {
                            "Get_multiple_embeddings": [
                                "SUCCEEDED"
                            ]
                        }
                    }
                },
                "runAfter": {
                    "List_all_the_blobs_using_path": [
                        "SUCCEEDED"
                    ]
                }
            },
            "List_all_the_blobs_using_path": {
                "type": "ServiceProvider",
                "inputs": {
                    "parameters": {
                        "containerName": "input"
                    },
                    "serviceProviderConfiguration": {
                        "connectionName": "AzureBlob-1",
                        "operationId": "listBlobs",
                        "serviceProviderId": "/serviceProviders/AzureBlob"
                    },
					"retryPolicy": {
						"type": "none"
					}
                },
                "runAfter": {}
            }
        },
        "contentVersion": "1.0.0.0",
        "outputs": {},
        "triggers": {
            "Recurrence": {
                "type": "Recurrence",
                "recurrence": {
                    "frequency": "Month",
                    "interval": 1
                }
            }
        }
    },
    "kind": "Stateful"
}