Last time I explained, how I added a data source to Azure Open AI by using Azure Cognitive Search (read more). This was strait forward because I uploaded my documents directly to my Azure Blob Storage. Furthermore, Azure Blob storage is a supported data source for Azure Cognitive Search.
Now, the question arises: How can I streamline this process? How can I automatically upload new documents to Azure Cognitive Search? In detail, I aim to automate the storage of new documents in my Blob store in order to continuously improve my AI capabilities. Furthermore, I plan to share the benefits of my automation with my department and my colleagues.
The solution is clear to me: I will automate this task by creating a Power Automate Flow. Even better, I can easily share this automation with my colleagues.
Use Power Automate for Upload!
As mentioned, I use again my Azure Blob Storage as data source for Azure Cognitive Search. Furthermore, my used files are PowerPoints and PDF-Documents. Perfect, all these file types are listed as Supported File Types. This means, Azure Cognitive Search can extract the content out of these files and use this information for my search. Moreover, the Azure Cognitive Search indexer can index my files stored in my Azure Blob Storage.
So good so far, but how can I add my files to my Azure Blob Storage? Right, I create a Power Automate Flow to solve this problem. In detail, I will use a the Power Automate Flow together with the Create Block Blob (v2) action to store my files in my blob storage.
My flow to upload files is this:
As you see, I use the PowerApps (V2) trigger with one input parameter
File. Right, this is my file. Furthermore, I add a Compose action to get the name of my selected file. The compose code is this:
Finally, I create a block blob in my Azure Blob Storage by using the Create Block Blob (v2) action. Here I’m using the result of my
Compose action as file name and the content of my
Now I can test my flow. I start my flow and select the file
Perfect, this works as expected!
My file is uploaded to my blob storage after my flow execution:
Here is the simplified architecture for uploading my files to an Azure Blob Storage by using a Power Automate Flow:
Well done, my upload is automated!
Sharing my Flow
In the next step I want to share my Power Automate Flow with others. For this I must firstly change the behavior of my flow regarding the used connection to my Azure Blob Storage. I navigate to my flow settings and edit the
Run only users section:
Here I can also invite other users and groups to use my flow. Furthermore, I can change my connection setup into
Use this connection (...):
This allows other users to reuse my configured connection without setting up an own connection:
In conclusion, I share my Azure Blob Storage connection including all rights of my connection setup with other users. In my described use case, I want to share my prepared Power Automate Flow to allow other users to upload common documents into my shared Blob Storage. This is because our shared documents are available for the whole company and should be accessible from our AI empowered chat bot.
Note: Be careful when you share your connections. You also share the included access rights with other users.
Azure Cognitive Search
Now my files are automatically uploaded. In other words, my files are in my Azure Blob Storage. This means, it’s time for Azure Cognitive Search to continue. In detail, I have set up a schedule for my indexer. I configure the parameter
hourly for my
documents-indexer which is good for my example:
Now my indexer in Azure Cognitive Search frequently starts a new run on my configured data source. In detail, my indexer will update my search index automatically. For this, new files are added, and changes are applied to the search index.
I check the execution history and see the result:
In the end, Azure Open AI and my Chatbot retrieve the new search results automatically. This means also, I must not change my Chatbot app and the data source configuration of my Azure Open AI service. The content of new documents is directly available for my Chatbot.
Let me summarize my small example. I explained how I extend my existing setup where Azure Cognitive Search scan documents in my Azure Blob Storage and provides search information to my Azure OpenAI Chatbot. Furthermore, I turned the problem of manual uploading files into my Azure Blob storage into an advantage by automating this scenario with a Power Automate Flow and sharing this flow with others.
In detail, I explained how I configured my Power Automate Flow. I used the PowerApps (V2) trigger with one parameter – my file. Afterwards, I composed the file name and uploaded my file content into my Azure Blob Storage. Then, I changed the connection configuration and shared my Power Automate Flow with my colleagues. The benefit of this is, instead of sharing the access to my central document store (Azure Blob Storage) with my colleagues, my colleagues can now add documents by using my Power Automate Flow.
Finally, I explained how I configured my Azure Cognitive Search indexer to run frequently. As result, my indexer keeps my search index up to date. Much better, my Open AI Chatbot can provide information based on the found documents without any changes.
Here is a simplified overview of my architecture how I add new documents to my Azure Cognitive Search document store:
This is a small automation example where Power Automate Flows helps my Azure Open AI to stay up to date with fresh information from my documents…