Connect your data to Azure OpenAI for Generative Answers in Copilot

We will see the steps needed to connect data through Azure OpenAI Service in Microsoft Copilot Studio, so that your copilots can use resources from Azure through the generative answers node

Connect your data to Azure OpenAI for Generative Answers in Copilot

Table of Contents

Introduction

Connecting data through Azure OpenAI Service within Microsoft Copilot Studio enables your Copilots to utilize Azure resources effectively via the Generative Answers node. Leveraging the robust capabilities of Azure AI Search and Azure OpenAI, these copilots can deliver responses that are both contextually relevant and compliant with your organization’s guidelines. In this blog we will see how to create a Power Apps FAQ copilot utilizing the official Microsoft PowerApps documentation PDF and leveraging the Azure AI Search and Azure Open AI.

Process Flow Explanation

The overall process flow that we will see in this explanation is as follows :

  1. User Interaction: A user initiates a query related to Power Apps via the Copilot interface.
  2. Copilot Processing: The Copilot captures the user’s query and passes it as a prompt to the Azure OpenAI, which is configured as a datasource.
  3. Azure OpenAI Processing: Azure OpenAI processes the query using its generative capabilities, accessing the indexed Power Apps documentation stored in Azure AI Search.
  4. Azure AI Search Integration: Azure AI Search retrieves relevant information from the uploaded Power Apps documentation PDF, stored in a storage account.
  5. Contextual Response: The Azure OpenAI generates a contextual response based on the retrieved information and sends it back to the Copilot.
  6. User Display: The Copilot displays the contextual response to the user, providing accurate and detailed answers to their Power Apps-related queries.

This integration allows users to get precise answers to their queries by leveraging the power of Azure’s AI services, making it a valuable tool for enhancing productivity and knowledge access.

Download Power Apps Documentation

Demo

Watch the demo video below to see how the Power Apps FAQ Copilot works.

Prerequisites

Before diving into the implementation, ensure you have the following:

  • An active Azure subscription.
  • Access to Microsoft Copilot Studio.
  • Power Apps Documentation PDF.

Step-by-Step Implementation

Step 1: Download the Power Apps Documentation

Head over to the Power Apps Documentation and download the PDF. We will index it using the Azure search service and use it to generate contextual answers to user queries around Power Apps.

Download Power Apps Documentation

Step 2: Create an Azure AI Search Instance

  1. Navigate to the Azure Portal: Log in to the Azure portal, search for “AI Search,” and select the service. Navigate to AI Search
  2. Create a New Search Service: Click on Create to start setting up a new search service. Create New Search Service
  3. Fill in the necessary details like resource group, service name, location, and pricing tier. Once you’ve filled in the details, review your configurations and click Create. Fill in Details
  4. After a while, the search instance will be provisioned and available for use. Search Instance Provisioned

Step 3: Add Blob Storage and Create an Indexer

  1. Set Up Azure Blob Storage: Navigate to the Storage Accounts in the Azure portal and click on Create to add a new storage account. Setup Blob Storage
  2. Fill in the necessary details like resource group, storage account name, region, and performance. Click on Create to provision the storage account. Provision Storage Account
  3. Once the storage account is created, head over to this resource and click on Container to create a new container to store the Power Apps PDF. Create Container
  4. Click on Container, specify the container name, and click on Create to add the new container to the storage account. Specify Container Name
  5. Inside the container, click on Browse for files to add the Power Apps documentation PDF downloaded earlier. Click on Upload. Upload PDF
  6. Navigate back to the Azure search instance that we created to index this PDF document. From the AI Search Overview page, click on Import data. Import Data
  7. In the Connect your data tab, select Azure Blob Storage. Select Blob Storage
  8. Specify a name for the datasource and click on Choose an existing connection to connect to the container within the storage account. Choose Existing Connection
  9. Select the appropriate container and click on Select. Select Container
  10. The connection string is automatically added for this container. Click on Next: Add Cognitive Skills. This is optional and will be skipped for now. Connection String Added
  11. Ensure the content field of the indexer is marked as Retrievable and Searchable. Click on Create an Indexer to create the index. Create Indexer
  12. The indexer is now created, and we can connect this to Azure OpenAI for generative features.

Step 4: Create Azure OpenAI Instance

  1. Navigate to Azure OpenAI: Head over to Azure, search for Azure OpenAI, and select the service. Search Azure OpenAI
  2. Click on Create. Create OpenAI Instance
  3. Specify the values for Resource Group, Name, and Pricing tier. Click on Next for network-specific configurations. Finally, click on Create on the review page. Specify Details
  4. The Azure OpenAI Instance is now created. Click on Go to Azure OpenAI Studio where we can configure and connect the OpenAI Instance with the Azure Search indexer. Go to OpenAI Studio
  5. In Azure OpenAI Studio, create a model deployment. From the Chat section, click on Create new deployment. Create Model Deployment
  6. Specify the model type (e.g., gpt-4), mention the name, and click on Create. Specify Model Type
  7. The model is deployed. In the chat playground, click on Add your data to connect to the search index. Model Deployed
  8. Select the data source. Select Data Source
  9. In the opened pop-up:
    • Select the data source as Azure AI Search.
    • Mention the Search Instance and Search Index created earlier.
    • Click on Next. Configure Data Source
  10. In the Data Management section, enable Keyword search. Semantic search is also an option that can be configured. Enable Keyword Search
  11. Select API Key as the Azure resource authentication type. Click on Next. Select API Key
  12. Finally, click on Save and close to finalize the data source setup. Save and Close
  13. Test the Azure OpenAI playground, which has its data source as Azure AI Search. For example, ask about Power Apps offline functionality, and it will fetch detailed contextual answers from the Azure AI search index. Test OpenAI Playground

Step 5: Integrate Copilot with Azure OpenAI Instance

  1. Deploy to Copilot Studio: Click on Deploy to and select A new copilot in Copilot Studio. Deploy to Copilot Studio
  2. Select Continue in Copilot Studio, which will take us to Copilot Studio to continue with the copilot creation. Continue in Copilot Studio
  3. Specify the copilot name and click on Create. Specify Copilot Name
  4. This initializes the copilot, which is already connected to the Azure OpenAI Instance. Copilot Initialized
  5. Head over to topics and select the Conversational boosting system topic. Select Conversational Boosting System
  6. It contains a Generative answers node preconfigured with the Azure OpenAI instance set up earlier. Generative Answers Node
  7. Click on the connection properties. Under the General tab, you can see the model details and parameters used for generating answers. General Tab
  8. In the Model data tab, you can see the Azure AI Search data source and the field from which the data is grounded. Model Data Tab
  9. The copilot is auto-configured and connected to the Azure OpenAI instance, which is internally connected with the Azure AI Search Instance.

Step 6: Publish the Bot

  1. We can publish the bot to different channels. For now, deploy it to Teams. Deploy to Teams
  2. Head over to Channels -> Microsoft Teams -> Turn on Teams. Turn on Teams
  3. Click on Availability Options to choose how to distribute the app in Teams. Availability Options
  4. You can either deploy it to the app store through admin approval or upload the app as a zip and use it as a personal app. Deploy Options
  5. The app becomes available in the Teams admin centre, and the admin can now publish it for org-wide use. App in Teams Admin Centre
  6. Access the app from the Teams App Store and start a conversation. Ask anything about Power Apps, and the copilot will fetch contextual answers from the grounded Power Apps Documentation PDF and provide responses. Access App in Teams

Conclusion

Integrating Azure OpenAI Service with Microsoft Copilot Studio opens up a realm of possibilities for creating intelligent, data-driven copilots. This guide has walked you through the process of setting up Azure AI Search, configuring Azure OpenAI, and seamlessly connecting these services in Copilot Studio. By harnessing the power of Azure’s AI capabilities, you can build copilots that provide rich, contextual responses tailored to your organizational needs.