Skip to main content What is Dynamics 365? Guided tours Customer stories Try our products Build your own agents CRM ERP Sales Service Sales Customer Insights Customer Service Contact Center Field Service Supply Chain Management Commerce Finance Project Operations Human Resources Business Central Pricing Business application topics Training & certifications Migrate to the cloud Documentation Events Dynamics 365 Blog Product updates Onboarding and implementation Community Find a partner Software Development Companies Partner resources Microsoft Marketplace Product documentation Technical support On-premises product support Contact us Try for free Sign in
  • 1 min read

Microsoft Dynamics AX 2012 Reporting extensions: Error System.Security.Permissions.EnvironmentPermission while running report


We run into issue that whenever we used a Microsoft Dynamics AX configuration file with a Reporting Services instance the following error was reported the first time a report was run after the restart of the SQL Reporting Services instance:

“The DefaultValue expression for the report parameter ‘AX_CompanyName’ contains an error: Request for the permission of type ‘System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’ failed. (rsRuntimeErrorInExpression)”

Running the report for the second time, it renders without any error. The error is mostly seen with subsequent instances of Reporting Services because only then an Microsoft Dynamics AX configuration file (Microsoft.Dynamics.AX.ReportConfiguration.axc) is used but any Reporting Services instance that is set up to use an AX configuration file will throw this error.

The resolution we found was to use “FullTrust” permission set in place of  “Execute” for the “Report_Expressions_Default_Permissions” in the rssrvpolicy.config

Existing configuration:

<CodeGroup
class=”UnionCodeGroup”
version=”1″
PermissionSetName=”Execution”
Name=”Report_Expressions_Default_Permissions”
Description=”This code group grants default permissions for code in report expressions and Code element. “>
[…]
</CodeGroup>

Replacement configuration:

<CodeGroup
class=”UnionCodeGroup”
version=”1″
PermissionSetName=”FullTrust”
Name=”Report_Expressions_Default_Permissions”
Description=”This code group grants default permissions for code in report expressions and Code element. “>[..]

</CodeGroup>

Get started with Dynamics 365

Drive more efficiency, reduce costs, and create a hyperconnected business that links people, data, and processes across your organization—enabling every team to quickly adapt and innovate.