Quantcast
Channel: Microsoft Dynamics 365 Community
Viewing all articles
Browse latest Browse all 51311

Deploy Dynamics CRM with PowerShell Part 3: Auditing

$
0
0

Today's post is written by Ian Moore, a developer at Sonoma Partners.

Making sure that auditing is enabled and configured correctly is usually a critical step when setting up a new Dynamics CRM organization, especially a production instance. Everything related to auditing can easily be added to a deployment or setup script with a couple extra lines of PowerShell code.

The first step in configuring auditing for your organization is to make sure it is enabled at the system level. If it is not enabled here, no auditing will ever occur. Here is a simple code snippet to test if your CRM organization has auditing enabled, and to enable it if it does not:

From there, you will need to ensure that auditing is enabled at the entity level for all data where you want to track changes. If you’re not sure which entities have been configured to audit, you can actually use PowerShell to generate a simple report of your current entity audit settings:

clip_image001

Once you know which entities still need to have auditing enabled, you can use metadata updates to configure each entity. The following snippet would enable auditing for accounts:

As with any metadata changes, you will need to make sure to publish changes for the entity. The easiest way from your PowerShell script would be to use the Publish-CrmAllCustomization function. If you are only updating a handful of entities, you could also create a PublishXmlRequest similar to the UpdateEntityRequest above rather than publishing all changes.

Hopefully these snippets help eliminate necessary manual steps when configuring auditing in your CRM environment.

Make sure to download the Microsoft.Xrm.Data.PowerShell module from GitHub at https://github.com/seanmcne/Microsoft.Xrm.Data.PowerShell and follow https://blogs.msdn.microsoft.com/crminthefield/ for updates to the module!


Viewing all articles
Browse latest Browse all 51311

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>