CRM User Audit Export

A command-line tool to export user audit data from Microsoft Dynamics Online



Build with Microsoft Visual Studio 2017 or equivalent


All requirements should be included as nuget packages in packages.config

  • CommandLineParser 2.3.0
  • Microsoft.CrmSdk.CoreAssemblies
  • Microsoft.CrmSdk.Deployment
  • Microsoft.CrmSdk.Workflow
  • Microsoft.CrmSdk.XrmTooling.CoreAssembly
  • Microsoft.IdentityModel.Clients.ActiveDirectory
  • Newtonsoft.Json 6.0.8



Running CRMUserAudit.exe with no arguments will give you a list of all arguments and descriptions.

Copyright c  2018
Required option 'url' is missing.
Required option 'username' is missing.
Required option 'password' is missing.

  --url               Required. URL of Dynamics 365 instance.

  --username          Required. Username with Audit access.

  --password          Required. Password for user with Audit 

  --path              (Default: .\) Path to export results.

  --filename          (Default: CRMAuditExport.csv) Filename 
to export results.

  --days              (Default: 30) Number of days to export 
data for.

  --filteruser        Username to filter.  If not specified, 
will export all users except SYSTEM

  --excludeobjects    Logical names of objects to exclude 
from export.  Separated by commas.

  --help              Display this help screen.

  --version           Display version information.


–url, –username and –password are the minimum required arguments. Default values will export all user audit data for the last 30 days.

.\CRMUserAudit.exe --url 
--username --password password

–path and –filename allow you to specify where the export file is saved.

.\CRMUserAudit.exe --url 
--username --password password --path "C:\Export\" --filename "Results.csv"

–days controls how many days of data will be exported, counting backwards from run time. A value of 7 will export data for the last 7 days.

.\CRMUserAudit.exe --url 
--username --password password --days 7

–filteruser filters the results by a single user, default is to export data for all users except SYSTEM. Operates on the display name of the user.

.\CRMUserAudit.exe --url 
--username --password password --filteruser "Grace Jackson"

–excludeobjects is a comma separated list of objects that you want to exclude from the export. Operates on the logical name of the object.

.\CRMUserAudit.exe --url 
--username --password password --excludeobjects 
Comment List