Export User Access Audit Logs

We recently had a requirement to export user audit log so see which users access the D365 CE. As we aware we cannot export these directly from D365 CE. After some googling, we came across this fetchXML code which can retrieve the user access audit logs

<fetch mapping = 'logical' aggregate = 'true' version = '1.0' >
<entity name = 'audit'>
<attribute name = 'createdon' alias = 'LastLoginDate' aggregate = 'max' />
<filter type="and">
      <condition attribute="createdon" operator="last-x-months" value="3" />
	  <condition attribute = 'operation' operator = 'eq' value = '4' />
</filter>
<link-entity name = 'systemuser' from = 'systemuserid' to = 'objectid' alias = 'su' link-type = 'inner' >
<attribute name = 'fullname' alias = 'fn' groupby = 'true' />
<attribute name = 'domainname' alias = 'dn' groupby = 'true' />
<attribute name = 'userlicensetype' alias = 'ult' groupby = 'true' />
<attribute name = 'accessmode' alias = 'am' groupby = 'true' />
<attribute name = 'isdisabled' alias = 'id' groupby = 'true' />
</link-entity>
</entity>
</fetch>

After this code, we then went onto using fetchXML, executing the code provided the below results in an XML format with a lost of user access audit records. The xml can then be converted into excel using free online conversion tools such as https://cdkm.com/xml-to-xls

Leave a Comment

Your email address will not be published. Required fields are marked *