Search code examples
powershelldynamics-crmoctopus-deploy

Can I add/update CRM Dynamics plugin assemblies using C# or Powershell?


I need to update Dynamics CRM 365 (on-premise) plugins in a repetable way using Octopus Deploy, but to do that I need to find a way to script this update instead of doing it manually.

Is it possible to do it using the CRM SDK or directly using Powershell?


Solution

  • Yes, it is possible to perform plugin registration with the CRM SDK and/or Powershell.

    This can be achieved by creating/updating/deleting certain records (entity logical names are pluginassembly, plugintype, sdkmessageprocessingstep, and sdkmessageprocessingstepimage) with suitable attribute values as well as matching references to other plugin-related entities like sdkmessage and sdkmessagefilter.

    At my company, we have developed our own automatic plugin registration through code, which can be performed by running a simple script. This script can also be run by a build server (like Octopus or VSO), to automatically create/update/delete the plugin registrations in CRM to match those found in our code.

    You can check out the source code for it (written in F#) on our GitHub.