Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Dynamics CRM 365 (Online) plugin exception EnvironmentPermission using Azure Application Insights

Posted on by

Hi,

I am trying to track custom events using a plugin and Azure Application Insights. When I build the plugin, I use MSBuild.ILMerge.Task to merge the Application.Insights.dll with my plugin assembly. Here are the steps I 

followed to do the merge:  http://dynamicscrmcoe.com/il-merge-dynamics-crm-plugins/

The problem I have is that when I try to instantiate the Telemetry client:

var telemetryClient = new TelemetryClient();

I get this error:

Request for the permission of type 'System.Security.Permissions.EnvironmentPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

I have tried granting permissions by using security attributes:

[EnvironmentPermission(SecurityAction.Assert, Unrestricted = true)]


and have also tried

[PermissionSet(SecurityAction.Assert, Name = "FullTrust")]

But nothing seems to work. Any ideas/advice would be appreciated.

Thanks in advance.



*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamics CRM 365 (Online) plugin exception EnvironmentPermission using Azure Application Insights

    The Application Insights assembly will not run sandboxed for various reasons related to the telemetry platform implementation. However, I've been working on a new implementation that is sandbox-safe. Check it out if you'd like at github.com/.../wiki.

  • Verified answer
    jlattimer Profile Picture
    jlattimer 24,558 on at
    RE: Dynamics CRM 365 (Online) plugin exception EnvironmentPermission using Azure Application Insights

    Not all assemblies can be successfully ILMerged and used in the CRM Online sandbox.

    Sandboxed plug-ins run in partial trust - https://msdn.microsoft.com/en-us/library/gg334752.aspx

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans