Error Faced while registering Plugin in On-premise CRM

Sending
User Review
0 (0 votes)

Introduction:

In Dynamics 365 CRM, plugin is the most useful component to implement custom business logic. Plugin is the most used feature of Dynamics 365 CRM. Recently, a client requested us to add their functional requirement in Dynamics 365 CRM, so we developed a plugin to fulfill these requirements. But when we tried to register the plugin using the plugin registration tool we got the below error due to which we were not able to register the plugin. We tried to install the plugin through solution but even then we got the same error.

Plugin register error in on-premise

Given below is the trace log that we got.

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Cannot open Sql Encryption Symmetric Key because Symmetric Key password does not exist in Config DB.

Detail: <OrganizationServiceFault xmlns=”http://schemas.microsoft.com/xrm/2011/Contracts” xmlns:i=”http://www.w3.org/2001/XMLSchema-instance”>

  <ActivityId>557910eb-7a5f-434a-b7ea-d7e85962d046</ActivityId>

  <ErrorCode>-2147187410</ErrorCode>

  <ErrorDetails xmlns:a=”http://schemas.datacontract.org/2004/07/System.Collections.Generic”>

    <KeyValuePairOfstringanyType>

      <a:key>ApiExceptionSourceKey</a:key>

      <a:value i:type=”b:string” xmlns:b=”http://www.w3.org/2001/XMLSchema”>Plugin/Microsoft.Crm.ObjectModel.PluginAssemblyService</a:value>

    </KeyValuePairOfstringanyType>

    <KeyValuePairOfstringanyType>

      <a:key>ApiOriginalExceptionKey</a:key>

      <a:value i:type=”b:string” xmlns:b=”http://www.w3.org/2001/XMLSchema”>Microsoft.Crm.CrmException: Cannot open Sql Encryption Symmetric Key because Symmetric Key password does not exist in Config DB. —&gt; Microsoft.Crm.CrmException: Cannot open Sql Encryption Symmetric Key because Symmetric Key password does not exist in Config DB.

   at Microsoft.Crm.Query.SymmetricKeyPasswordRetriever.RetrievePassword(Guid organizationId)

   at Microsoft.Crm.Query.ServerQuerySqlCellLevelEncryption.AddOpenEncryptionChainCommand(StringBuilder sqlString, Guid organizationId)

   at Microsoft.Crm.Query.CrmSqlSelectCommandStrategy.AddOpenEncryptionChainCommand(StringBuilder sqlValue)

   at Microsoft.Crm.Query.CrmSqlSelectCommandStrategy.WritePreSelectCommandComponents(StringBuilder sqlString)

   at Microsoft.Crm.Query.CrmSqlSelectCommandStrategy.GetCommandString(Boolean writeOutPreAndPostSelectComponents)

   at Microsoft.Crm.Query.SelectPlan.&lt;GetSql&gt;b__3_0()

After troubleshooting the error, we found the cause and thereby the solution to resolve it.

We found that this issue occurred because the “Encryption key” was not created in this CRM. When we go to Data Encryption to create the Encryption key then it throws the below error.

Plugin register error in on-premise 2

To resolve the above error, we have to execute the below query in SQL database.

Plugin register error in on-premise

After we execute the query, we can go to Data encryption and create the Encryption key as shown below:

Plugin register error in on-premise

After we create the encryption key we will be able to register the plugin successfully.

Conclusion:

As illustrated above, to register some plugins in On-premise it is necessary to create Encryption key in Dynamics 365 CRM.