Over the past few weeks, we evaluated multiple approaches to send richer telemetry to Application Insights from our Dynamics 365 plugins. The goal was simple: improve observability without violating the Dynamics sandbox rules. After validating each approach against Microsoft’s official documentation, here’s what we learned.
Goal
Enable reliable, maintainable telemetry logging from Dynamics 365 plugins to Azure Application Insights.
What We Tried — and What Microsoft Documentation Confirms
Application Insights SDK Integration
Dynamics plugins run in a partial trust sandbox, and Microsoft explicitly notes that external assemblies and complex dependencies often fail to load. This matched our experience: the SDK couldn’t run due to sandbox restrictions and dependency conflicts.
DLL Merging (ILMerge / ILRepack)
Microsoft does not recommend or support merging large dependency trees for sandboxed plugins. Our attempt confirmed this — too many unresolved assemblies, making the approach impractical.
Lightweight Telemetry via HTTP POST (Final Approach)
Microsoft’s guidance allows outbound HTTPS calls from plugins when properly configured.
Using HttpClient to send telemetry directly to the Application Insights ingestion endpoint worked flawlessly.
We successfully logged custom events enriched with plugin context and validated them using KQL in Azure Logs.
Key Learnings (Fully Aligned with Microsoft Guidance)
- Avoid heavy SDKs inside Dynamics plugins — the sandbox is restrictive by design.
- Use Secure Configuration for sensitive values like Instrumentation Keys.
- Lightweight HTTP telemetry is the most reliable, supportable, and future‑proof approach for plugin observability.
Next Steps?
- Standardize this lightweight telemetry pattern across all plugins.
- Build a reusable Telemetry Helper to simplify adoption.
- Create Azure dashboards and alerts to monitor plugin health, failures, and performance trends.
Visual Path
If you’re exploring telemetry for Dynamics plugins or want to see the helper pattern we built, feel free to reach out.
#Dynamics365 #PowerPlatform #Azure
#ApplicationInsights #Telemetry #Observability #PluginDevelopment #D365Developers #MicrosoftDynamics
#AzureMonitor #KQL #SolutionArchitecture #TechLeadership #Dataverse #powerapps
No comments:
Post a Comment