Blog Post

AI - AI Platform Blog
5 MIN READ

Integrate Custom Azure AI Agents with CoPilot Studio and M365 CoPilot

hannahabbott's avatar
hannahabbott
Icon for Microsoft rankMicrosoft
Apr 16, 2025

Integrating Custom Agents with Copilot Studio and M365 Copilot

 

In today's fast-paced digital world, integrating custom agents with Copilot Studio and M365 Copilot can significantly enhance your company's digital presence and extend your CoPilot platform to your enterprise applications and data. This blog will guide you through the integration steps of bringing your custom Azure AI Agent Service within an Azure Function App, into a Copilot Studio solution and publishing it to M365 and Teams Applications.

 

When Might This Be Necessary:

 

Integrating custom agents with Copilot Studio and M365 Copilot is necessary when you want to extend customization to automate tasks, streamline processes, and provide better user experience for your end-users. This integration is particularly useful for organizations looking to streamline their AI Platform, extend out-of-the-box functionality, and leverage existing enterprise data and applications to optimize their operations. Custom agents built on Azure allow you to achieve greater customization and flexibility than using Copilot Studio agents alone.

 

What You Will Need: To get started, you will need the following:

  • Azure AI Foundry
  • Azure OpenAI Service
  • Copilot Studio Developer License
  • Microsoft Teams Enterprise License
  • M365 Copilot License

Steps to Integrate Custom Agents:

Create a Project in Azure AI Foundry: Navigate to Azure AI Foundry and create a project. Select 'Agents' from the 'Build and Customize' menu pane on the left side of the screen and click the blue button to create a new agent.

Customize Your Agent: Your agent will automatically be assigned an Agent ID. Give your agent a name and assign the model your agent will use. Customize your agent with instructions:

 

 

 

Add your knowledge source:  You can connect to Azure AI Search, load files directly to your agent, link to Microsoft Fabric, or connect to third-party sources like Tripadvisor. In our example, we are only testing the CoPilot integration steps of the AI Agent, so we did not build out additional options of providing grounding knowledge or function calling here. 

 

Test Your Agent: Once you have created your agent, test it in the playground. If you are happy with it, you are ready to call the agent in an Azure Function.

 

Create and Publish an Azure Function: Use the sample function code from the GitHub repository to call the Azure AI Project and Agent. Publish your Azure Function to make it available for integration. azure-ai-foundry-agent/function_app.py at main · azure-data-ai-hub/azure-ai-foundry-agent

Connect your AI Agent to your Function: update the "AIProjectConnString" value to include your Project connection string from the project overview page of in the AI Foundry.  

 

Role Based Access Controls: We have to add a role for the function app on OpenAI service. Role-based access control for Azure OpenAI - Azure AI services | Microsoft Learn

  1. Enable Managed Identity on the Function App
  2. Grant "Cognitive Services OpenAI Contributor" role to the System-assigned managed identity to the Function App in the Azure OpenAI resource
  3. Grant "Azure AI Developer" role to the System-assigned managed identity for your Function App in the Azure AI Project resource from the AI Foundry

 

Build a Flow in Power Platform: Before you begin, make sure you are working in the same environment you will use to create your CoPilot Studio agent. To get started, navigate to the Power Platform (https://make.powerapps.com) to build out a flow that connects your Copilot Studio solution to your Azure Function App.

When creating a new flow, select 'Build an instant cloud flow' and trigger the flow using 'Run a flow from Copilot'.

 

 

Add an HTTP action to call the Function using the URL and pass the message prompt from the end user with your URL. The output of your function is plain text, so you can pass the response from your Azure AI Agent directly to your Copilot Studio solution.

 

 

 

Create Your Copilot Studio Agent: Navigate to Microsoft Copilot Studio and select 'Agents', then 'New Agent'. Make sure you are in the same environment you used to create your cloud flow. 

 

 

Now select ‘Create’ button at the top of the screen  

 

 

From the top menu, navigate to ‘Topics’ and ‘System’. We will open up the ‘Conversation boosting’ topic.

 

 

When you first open the Conversation boosting topic, you will see a template of connected nodes. Delete all but the initial ‘Trigger’ node.

 

 

Now we will rebuild the conversation boosting agent to call the Flow you built in the previous step. Select 'Add an Action' and then select the option for existing Power Automate flow. Pass the response from your Custom Agent to the end user and end the current topic.

My existing Cloud Flow:

Add action to connect to existing Cloud Flow: 

 

When this menu pops up, you should see the option to Run the flow you created. Here, mine does not have a very unique name, but you see my flow 'Run a flow from Copilot' as a Basic action menu item. If you do not see your cloud flow here  add the flow to the default solution in the environment. Go to Solutions > select the All pill > Default Solution > then add the Cloud Flow you created to the solution. Then go back to Copilot Studio, refresh and the flow will be listed there. 

Now complete building out the conversation boosting topic:

 

Make Agent Available in M365 Copilot: Navigate to the 'Channels' menu and select 'Teams + Microsoft 365'.

 

 

Be sure to select the box to 'Make agent available in M365 Copilot'. Save and re-publish your Copilot Agent.

 

 

It may take up to 24 hours for the Copilot Agent to appear in M365 Teams agents list. Once it has loaded, select the 'Get Agents' option from the side menu of Copilot

 

 

and pin your Copilot Studio Agent to your featured agent list

 

 

Now, you can chat with your custom Azure AI Agent, directly from M365 Copilot!

 

 

 

 

 

Conclusion: By following these steps, you can successfully integrate custom Azure AI Agents with Copilot Studio and M365 Copilot, enhancing you’re the utility of your existing platform and improving operational efficiency. This integration allows you to automate tasks, streamline processes, and provide better user experience for your end-users. Give it a try!

 

Curious of how to bring custom models from your AI Foundry to your CoPilot Studio solutions?

Check out this blog

Updated May 08, 2025
Version 4.0

6 Comments

  • mjcorkery's avatar
    mjcorkery
    Iron Contributor

    Hi, I have a question. I have some resources in Microsoft Fabric. I created a Copilot agent. I want to add Microsoft Fabric as a knowledge source. When I select Add knowledge > Advanced, I do not see Fabric as an option. I only see Azure AI Search, Azure SQL Enterprise websites, SalesForce, ServiceNow, and Zendesk.

    I could not find any documentation that tells me how ensure that Fabric shows up. Any ideas?

    • hannahabbott's avatar
      hannahabbott
      Icon for Microsoft rankMicrosoft

      The Agent service is in preview, so it may change from time to time. It also could be a regional availability, I am testing in West US and I do not yet see all of options you mention. 

  • Vargabence's avatar
    Vargabence
    Copper Contributor

    hannahabbott  I have a question. I created a custom flow as you said, but when I try to add an action, I can't find the flow.

    How can I add action?
    Thanks

    • hannahabbott's avatar
      hannahabbott
      Icon for Microsoft rankMicrosoft

      Please check that your flow and your Copilot agent are being created in the same environment. 

    • hannahabbott's avatar
      hannahabbott
      Icon for Microsoft rankMicrosoft

       Vargabence all the nodes under 'trigger' should be deleted first, then select the '+' button to 'Add an action'. When this menu pops up, you should see the option to Run the flow you created. Here, mine does not have a very unique name, but you see my flow 'Run a flow from Copilot' as a Basic action menu item.  Including a screenshot of my existing cloud flows to see how that name maps back to your flow.