This sample demonstrates how to integrate Azure Application Insights into existing Copilot "pro-code" declarative agents using TypeSpec and API plugins. This generic approach, combined with strategic prompting techniques, enables us to capture meaningful metrics for declarative agents.
The following blog post describes the complete solution setup: https://blog.franckcornu.com/post/add-app-insights-procode-copilot-da/
- Franck Cornu- M365 Development/Copilot extensibility MVP
| Version | Date | Comments |
|---|---|---|
| 1.0 | August 12, 2025 | Initial solution |
- Microsoft agents toolkit Visual Studio Code Extension
- Microsoft 365 Copilot license
- A Microsoft 365 account for development.
- Azure environment
- Clone this repository
- In Azure, create a new Azure Logic App as mentionned here: https://blog.franckcornu.com/post/add-app-insights-procode-copilot-da
- In the
env.devfile, fill the following values extracted from the Logic App HTTP Trigger URL:
LOGIC_APP_SERVER_URL=https://prod-27.<region>.logic.azure.com:443
LOGIC_APP_INVOKE_PATH=/workflows/<GUID>/triggers/<trigger_name>/paths/invoke
LOGIC_APP_TRIGGER_PATH=/triggers/<trigger_name>/run
- From Microsoft 365 Agents Toolkit, sign-in to your Microsoft 365 account.
- From Microsoft 365 Agents, provision the solution to create the Teams app.
- Go to https://www.office.com/chat?auth=2 URL and enable the developer mode by using the
-developer onprompt. - Ask a question like "What are my latest documents?". You should see the plugin triggered and data sent to the Logic App/Application Insights.
The following sample demonstrates the following concepts:
- Use Logic App as an API plugin by using specific endpoint and instructions.
- Pass parameter from the LLM context
Search for: da-appinsights-plugin-typespec
Search for: @FranckyC
We do not support samples, but this community is always willing to help, and we want to improve these samples. We use GitHub to track issues, which makes it easy for community members to volunteer their time and help resolve issues.
You can try looking at issues related to this sample to see if anybody else is having the same issues.
If you encounter any issues using this sample, create a new issue.
Finally, if you have an idea for improvement, make a suggestion.
THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.



