Copilot’s built-in knowledge is great, but sometimes you need fresh data or to trigger actions in your own systems. In this article, we’ll show you how to combine Retrieval-Augmented Generation (RAG) with a simple FastAPI service as a custom connector—so your Copilot Studio agent can pull live information and carry out real-world tasks.

For example, imagine your agent must query an SAP or Oracle ERP endpoint to fetch up-to-date inventory and pricing. You can wrap those product-list APIs in a FastAPI app and expose it as a connector that your Copilot agent calls at runtime.

Here’s how to put it all in place:

1. FastAPI service deployed in Azure

Assume you’ve taken your FastAPI “product-list” app and deployed it to Azure App Service (or Azure Container Apps), exposing it at https://my-products-api.azurewebsites.net . You can follow this link to have a code sample to build this FastAPI;

2. Create a Custom Connector in Power Apps

  1. Go to make.powerapps.com.
  2. Go to Custom connectors → New custom connector → Create from blank.
  3. General Information:
    • Host: php-templateCopyEdit<your-app>.azurewebsites.net
    • Base URL: leave as / if you don’t have a sub-path.Scheme: Choose HTTPS.
  4. Security (Authentication):
    • If your API is open, choose: yamlCopyEditNo authentication
    • If you use an API key or bearer token, configure it here.
    Click Definition.

Step 3: Define your API endpoints manually

Here you manually add each FastAPI route you wish to use.

Example: Fetch Product by ID

  • Click New Action:
    • Summary: Get Product by ID
    • Operation ID: GetProductById
    • Visibility: Important
  • Scroll down to Request and click + Import from sample:
    • Verb: GET
    • URL: arduinoCopyEdithttps://<your-app>.azurewebsites.net/products/{product_id}
    • Click Import.
      This automatically recognizes the parameter {product_id}.
  • Ensure the parameter is correctly recognized:
    • Click on product_id parameter to set its type (e.g., integer or string).

Step 4: Define the Response Manually

Under Response, click + Add default response:

  • Paste a valid JSON example response from your API. For example: jsonCopyEdit{ "id": 2, "name": "Gadget", "price": 29.99, "description": "An advanced gadget with lots of features." }
  • Click Import.

This auto-generates the response schema.

Step 5: Test your Connector

  1. Go to the Test tab.
  2. Click Create connector first, then refresh the page if required.
  3. Enter a valid product ID and test it:
    • Example: 2
    • Click Test Operation.

You should see your FastAPI response returned successfully.

3.Add your connector as a Copilot Studio skill

Configure Agent Behavior to call your Custom Connector

  • In the agent’s System prompt, clearly instruct your agent how and when to use your connector. For example:
When the user asks about a specific product by ID, call the ProductAPI connector using the "GetProductById" action, passing the specified ID as parameter. Format the response nicely as follows:

Product Name: [name]
Price: $[price]
Description: [description]

Leave a comment

I’m Jihane

This blog chronicles my personal journey into the world of AI, with a special focus on Microsoft AI technologies and innovations.

From hands-on tips and tutorials to deep dives into Microsoft’s AI ecosystem, I’ll cover how AI is reshaping productivity, development, and business workflows.

Let’s connect