{"id":42741,"date":"2025-11-05T15:20:08","date_gmt":"2025-11-05T09:50:08","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=42741"},"modified":"2025-11-05T15:20:08","modified_gmt":"2025-11-05T09:50:08","slug":"how-to-view-audit-storage-by-entity-in-dynamics-365-using-the-getauditstoragedetails-action","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2025\/11\/how-to-view-audit-storage-by-entity-in-dynamics-365-using-the-getauditstoragedetails-action\/","title":{"rendered":"How to View Audit Storage by Entity in Dynamics 365 Using the GetAuditStorageDetails Action"},"content":{"rendered":"<p><img decoding=\"async\" class=\"alignnone size-full wp-image-42742\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/11\/1GetAuditStorageDetails-Action.png\" alt=\"GetAuditStorageDetails Action\" width=\"1400\" height=\"800\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/11\/1GetAuditStorageDetails-Action.png 1400w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/11\/1GetAuditStorageDetails-Action-300x171.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/11\/1GetAuditStorageDetails-Action-1024x585.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/11\/1GetAuditStorageDetails-Action-768x439.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/11\/1GetAuditStorageDetails-Action-660x377.png 660w\" sizes=\"(max-width: 1400px) 100vw, 1400px\" \/><\/p>\n<h3><strong>Introduction<\/strong><\/h3>\n<p>In Microsoft Dynamics 365, <em>auditing<\/em> helps you keep track of what\u2019s happening inside your CRM. Every time a record is created, updated, or deleted, the system records this activity as an audit log.<\/p>\n<p>While this is great for transparency and troubleshooting, there\u2019s a challenge &#8211; the platform doesn\u2019t directly show how much storage each entity or partition is using for these audit logs.<\/p>\n<p>For administrators and developers, this lack of visibility can make it difficult to manage storage efficiently. Over time, audit logs can grow large, and organizations might suddenly find themselves hitting storage limits.<\/p>\n<p>To address this, Microsoft introduced the GetAuditStorageDetails Action in Dataverse.<br \/>\nThis feature provides a detailed breakdown of your audit log storage usage by offering insights such as:<\/p>\n<ul>\n<li>Total storage used by audit logs<\/li>\n<li>Distribution of audit data across entities or partitions<\/li>\n<\/ul>\n<p>In short, this action helps administrators and system maintainers analyze and optimize audit storage usage, making planning and monitoring far easier.<\/p>\n<p>In this blog, we\u2019ll demonstrate how to call this action using a C# console application, showing both the request structure and expected response.<\/p>\n<h3><strong>What Is the GetAuditStorageDetails Action?<\/strong><\/h3>\n<p>The GetAuditStorageDetails Action is a <strong>Dataverse API function<\/strong> that provides insights into how audit data is stored.<\/p>\n<p>It helps you identify which entities or partitions consume the most storage, enabling administrators to better control audit data retention and cleanup.<\/p>\n<h3><strong><br \/>\n<\/strong><strong>Step-by-Step: How to Use the GetAuditStorageDetails Action<\/strong><\/h3>\n<h3><strong>Step 1: Create a Console Application<\/strong><\/h3>\n<p>Start by creating a simple <strong>C# console application<\/strong> in Visual Studio.<br \/>\nMake sure you reference the <strong>Microsoft.PowerPlatform.Dataverse.Client<\/strong> package to use the ServiceClient class.<\/p>\n<p><strong>Step 2: Implement the Code<\/strong><\/p>\n<p>Below is an example method that retrieves audit storage details using the GetAuditStorageDetails action:<\/p>\n<pre class=\"lang:css gutter:true start:1\">private static void GetAuditDetails(ServiceClient value)\r\n\r\n{\r\n\r\ntry\r\n\r\n{\r\n\r\n\/\/ Create a new request to get audit storage details\r\n\r\nvar request = new OrganizationRequest(\"GetAuditStorageDetails\");\r\n\r\n\/\/ Execute the request using IOrganizationService\r\n\r\nvar response = value.Execute(request);\r\n\r\n\/\/ Retrieve the \"Result\" from the response, which contains audit storage info\r\n\r\nvar result = response.Results[\"Result\"];\r\n\r\n\/\/ Check if the result is not null\r\n\r\nif (result != null)\r\n\r\n{\r\n\r\n\/\/ Use reflection to get the AuditStorageDetails property from the Result object\r\n\r\nvar auditStorageDetailsProp = result.GetType().GetProperty(\"AuditStorageDetails\");\r\n\r\nif (auditStorageDetailsProp != null)\r\n\r\n{\r\n\r\n\/\/ Get the value of the AuditStorageDetails property\r\n\r\nvar auditStorageDetailsValue = auditStorageDetailsProp.GetValue(result);\r\n\r\n\/\/ Cast the value to IDictionary for iteration (AuditStorageDetails is a dictionary)\r\n\r\nIDictionary auditStorageDict = (IDictionary)auditStorageDetailsValue;\r\n\r\n\/\/ Log the total number of audit partitions\r\n\r\nConsole.WriteLine($\"AuditStorageDetails contains {auditStorageDict.Count} entries\");\r\n\r\n\/\/ Loop through each entry in the AuditStorageDetails dictionary\r\n\r\nforeach (DictionaryEntry entry in auditStorageDict)\r\n\r\n{\r\n\r\n\/\/ Log the key (usually the partition name or entity type)\r\n\r\nConsole.WriteLine($\"--- Key: {entry.Key} ---\");\r\n\r\n\/\/ Get the value (AuditStorageDetails object) for this key\r\n\r\nvar auditDetail = entry.Value;\r\n\r\nif (auditDetail != null)\r\n\r\n{\r\n\r\n\/\/ Get all properties of the AuditStorageDetails object\r\n\r\nvar props = auditDetail.GetType().GetProperties();\r\n\r\n\/\/ Loop through each property and log its name and value\r\n\r\nforeach (var prop in props)\r\n\r\n{\r\n\r\nvar propValue = prop.GetValue(auditDetail);\r\n\r\nConsole.WriteLine($\"{prop.Name}: {propValue}\");\r\n\r\n}\r\n\r\n}\r\n\r\nelse\r\n\r\n{\r\n\r\n\/\/ Log if the auditDetail value is null\r\n\r\nConsole.WriteLine(\"Value is null\");\r\n\r\n}\r\n\r\n\/\/ Separator for readability\r\n\r\nConsole.WriteLine(\"---------------------------------------------\");\r\n\r\n}\r\n\r\n}\r\n\r\nelse\r\n\r\n{\r\n\r\n\/\/ Log if AuditStorageDetails property is not found\r\n\r\n\/\/ Utility.SetTrace(\"AuditStorageDetails property not found in result.\", workflowConfig, ref traceLog);\r\n\r\n}\r\n\r\n}\r\n\r\n}\r\n\r\ncatch (Exception ex)\r\n\r\n{\r\n\r\nthrow new Exception(ex.Message);\r\n\r\n}\r\n\r\n}<\/pre>\n<p><strong>Step 3: Execute and Review Output<\/strong><\/p>\n<p>When you execute the code, it retrieves and displays audit storage information for each partition or entity.<\/p>\n<p><strong>Output<\/strong><\/p>\n<p><strong> <img decoding=\"async\" class=\"alignnone size-full wp-image-42743\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/11\/GetAuditStorageDetails-Action.png\" alt=\"GetAuditStorageDetails Action\" width=\"1736\" height=\"929\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/11\/GetAuditStorageDetails-Action.png 1736w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/11\/GetAuditStorageDetails-Action-300x161.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/11\/GetAuditStorageDetails-Action-1024x548.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/11\/GetAuditStorageDetails-Action-768x411.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/11\/GetAuditStorageDetails-Action-1536x822.png 1536w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2025\/11\/GetAuditStorageDetails-Action-660x353.png 660w\" sizes=\"(max-width: 1736px) 100vw, 1736px\" \/><\/strong><\/p>\n<p><strong><em>Note<\/em><\/strong><em>: When you first trigger the GetAuditStorageDetails Action, it may take some time to process \u2014 especially for large environments.<\/em><\/p>\n<p><em><br \/>\nThe <strong>Status<\/strong> field helps track progress:<\/em><\/p>\n<p><strong><em>Pending<\/em><\/strong><em> \u2192 The system is still compiling audit data.<\/em><\/p>\n<p><strong><em>Completed<\/em><\/strong><em> \u2192 The data is ready, and AuditStorageDetails contains the breakdown.<\/em><\/p>\n<p>Once complete, the console output lists each entity or partition and its respective audit storage metrics.<\/p>\n<h3><strong>Key Benefits of Using GetAuditStorageDetails<\/strong><\/h3>\n<ul>\n<li>Provides clear visibility into how audit data is stored across entities<\/li>\n<li>Helps in proactive storage management<\/li>\n<li>Reduces risk of unexpected storage overages<\/li>\n<li>Enables data-driven decisions for audit data retention<\/li>\n<\/ul>\n<p><strong>FAQs<\/strong><\/p>\n<ol>\n<li><strong> What does the GetAuditStorageDetails Action do in Dynamics 365?<\/strong><br \/>\nA. It retrieves detailed information about how much audit storage is being used, broken down by entity or partition. This helps administrators understand where storage is being consumed and manage it efficiently.<\/li>\n<li><strong> Do I need special permissions to run <\/strong><strong>the GetAuditStorageDetails Action?<\/strong><br \/>\nA. Yes. Only users with System Administrator or Audit-related privileges in Dataverse can execute the GetAuditStorageDetails Action.<\/li>\n<li><strong> How long does the GetAuditStorageDetails Action take to process?<\/strong><br \/>\nA. The processing time depends on your environment size and the total amount of audit data. When you first trigger the GetAuditStorageDetails Action, it may take several minutes as the system compiles and analyzes audit data across entities. During this period, the Status field typically shows <em>Pending<\/em>. Once complete, it changes to <em>Completed<\/em>, and the audit details become available.<\/li>\n<li><strong> Can I use the data from the GetAuditStorageDetails Action to clean up old audit logs?<\/strong><br \/>\nA. The data retrieved from the GetAuditStorageDetails Action only provides insights into storage usage; it doesn\u2019t perform cleanup. However, once you identify which entities consume the most audit storage, you can manually delete or archive old logs using the DeleteAuditData Action or configure audit retention policies to manage storage more effectively.<\/li>\n<\/ol>\n<h3><strong>Conclusion<\/strong><\/h3>\n<p>Understanding how audit data is stored is crucial for maintaining a healthy and optimized Dynamics 365 environment.<\/p>\n<p>By using the GetAuditStorageDetails action, developers and administrators can:<\/p>\n<ul>\n<li>Discover entity-specific and partition-level audit storage usage.<\/li>\n<li>Monitor audit growth patterns.<\/li>\n<li>Plan cleanup or retention strategies more effectively.<\/li>\n<\/ul>\n<p>This method not only simplifies monitoring and troubleshooting, but also ensures that organizations maintain a balanced and efficient auditing process in the long run.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction In Microsoft Dynamics 365, auditing helps you keep track of what\u2019s happening inside your CRM. Every time a record is created, updated, or deleted, the system records this activity as an audit log. While this is great for transparency and troubleshooting, there\u2019s a challenge &#8211; the platform doesn\u2019t directly show how much storage each\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2025\/11\/how-to-view-audit-storage-by-entity-in-dynamics-365-using-the-getauditstoragedetails-action\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":15,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[16,2361],"tags":[3256],"class_list":["post-42741","post","type-post","status-publish","format-standard","hentry","category-dynamics-365","category-technical","tag-getauditstoragedetails-action"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/42741","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/comments?post=42741"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/42741\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=42741"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=42741"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=42741"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}