Table of Contents
- Introduction
- Why Use Application Insights with Copilot Studio?
- Step-by-Step Guide to Integrating Application Insights with Copilot Studio
- Copilot Audit Logs
- Conclusion
Introduction
Microsoft Copilot Studio offers an innovative way to build interactive conversational bots. However, to ensure these bots operate smoothly and meet user expectations, integrating effective monitoring tools is crucial. This is where Azure Application Insights comes into play. Application Insights, a component of Azure Monitor, provides deep insights into application performance, user behaviors, and error diagnostics, making it an invaluable tool for enhancing the monitoring and error logging capabilities of your Copilot bots.
In this blog, we will explore how to integrate Application Insights with Copilot Studio Copilots to improve error logging and monitoring, ultimately leading to more reliable and user-friendly interactions.
Why Use Application Insights with Copilot Studio?
Application Insights offers a range of features that are beneficial for monitoring and improving Copilot performance:
- Real-Time Monitoring: Track the real-time performance and health of all your Copilots in the Copilot Studio, identifying issues as they arise.
- Detailed Error Logging: Capture detailed logs of errors and exceptions, enabling quicker diagnostics and resolution.
- User Interaction Analytics: Analyze user interactions to understand usage patterns and identify potential improvements.
- Custom Telemetry: Collect and analyze custom events tailored to your specific needs.
Step-by-Step Guide to Integrating Application Insights with Copilot Studio
Step 1: Setting Up Application Insights
-
Head over to Azure Application Insights
-
Specify the Subscription and instance details and click on Review + Create
-
Copy the connection string from the overview page
-
View the captured Copilot events in the events tab of the side pane
Step 2: Configure the Copilot
-
Select one of the Copilots created and go to Settings
-
To connect the Copilot with Application Insights:
- Select Copilot details
- Click on Advanced
- Paste the connection string from Application Insights
- Select the type of events and activities to capture
- Click on Save
Test the Runtime Error Events
-
Simulate a division by zero error in Power Fx by adding the formula
Value(9)/Value(0)
in the message node -
Test the Copilot in the test pane to see the runtime division by zero error
- Monitor these events in Application Insights
- View more insights to see detailed error logs
- Click on On Error Log to see detailed error logs
Test 2: System / Logical Errors
- Induce a system error by self-calling the topic, resulting in an infinite loop
- From within the topic named Tester, add a node and select Topic Management -> Go to another topic -> Tester
-
Test the Copilot from the test pane to see the infinite loop error
- View the detailed error logs in Application Insights
Test 3: Custom Telemetry Events
-
Log custom events using the “Log a custom telemetry event” action
-
Enter the custom event details to be logged
-
Invoke the custom telemetry node and check the logs in Application Insights
Copilot Audit Logs
The events around Copilot, such as creation, deletion, changes in authentication, basic details, and topic creation, are also monitored and written into audit logs accessible from Microsoft Purview. The general events logged are listed below:
Category | Event | Description |
---|---|---|
Copilots | BotCreate | The creation of a new Copilot in Copilot Studio |
Copilots | BotDelete | The deletion of a Copilot in Copilot Studio |
Copilots | BotAuthUpdate | Updating the authentication settings of a Copilot |
Copilots | BotIconUpdate | Updating the Copilot icon |
Copilots | BotPublish | Publishing of a Copilot |
Copilots | BotShare | Sharing of a Copilot to other users |
Copilots | BotAppInsightsUpdate | Updating the App Insights logging configuration |
Copilot Component | BotComponentCreate | The creation of a component (e.g., topic, skill) |
Copilot Component | BotComponentUpdate | The update of a component |
Copilot Component | BotComponentDelete | The deletion of a component |
AI Plugin | AIPluginOperationCreate | Creating an AI Plugin for a Copilot |
AI Plugin | AIPluginOperationUpdate | Updating an AI Plugin for a Copilot |
AI Plugin | AIPluginOperationDelete | Removing an AI Plugin for a Copilot |
Environment Variable | EnvironmentVariableCreate | Creating an environment variable for a Copilot |
Environment Variable | EnvironmentVariableUpdate | Updating an environment variable |
Environment Variable | EnvironmentVariableDelete | Deleting an environment variable |
-
Access these logs from the compliance portal by clicking on the Audit tab
-
Search for specific events within a timeline
-
View the detailed list of selected search events
Conclusion
Integrating Azure Application Insights with Microsoft Copilot Studio enhances monitoring, diagnosing, and optimizing Copilot applications. It provides detailed telemetry and error logging to gain insights into performance, quickly resolve issues, and understand user interactions. By capturing critical data on runtime and system errors and logging custom telemetry events, Application Insights ensures robust Copilot bots. Coupled with audit logs in Microsoft Purview, it ensures comprehensive tracking of key events for effective governance, reliability, and security of Copilot solutions.