How to View Audit Storage by Entity in Dynamics 365 Using the GetAuditStorageDetails Action

By | November 5, 2025

GetAuditStorageDetails Action

Introduction

In Microsoft Dynamics 365, auditing helps you keep track of what’s 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’s a challenge – the platform doesn’t directly show how much storage each entity or partition is using for these audit logs.

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.

To address this, Microsoft introduced the GetAuditStorageDetails Action in Dataverse.
This feature provides a detailed breakdown of your audit log storage usage by offering insights such as:

  • Total storage used by audit logs
  • Distribution of audit data across entities or partitions

In short, this action helps administrators and system maintainers analyze and optimize audit storage usage, making planning and monitoring far easier.

In this blog, we’ll demonstrate how to call this action using a C# console application, showing both the request structure and expected response.

What Is the GetAuditStorageDetails Action?

The GetAuditStorageDetails Action is a Dataverse API function that provides insights into how audit data is stored.

It helps you identify which entities or partitions consume the most storage, enabling administrators to better control audit data retention and cleanup.


Step-by-Step: How to Use the GetAuditStorageDetails Action

Step 1: Create a Console Application

Start by creating a simple C# console application in Visual Studio.
Make sure you reference the Microsoft.PowerPlatform.Dataverse.Client package to use the ServiceClient class.

Step 2: Implement the Code

Below is an example method that retrieves audit storage details using the GetAuditStorageDetails action:

private static void GetAuditDetails(ServiceClient value)

{

try

{

// Create a new request to get audit storage details

var request = new OrganizationRequest("GetAuditStorageDetails");

// Execute the request using IOrganizationService

var response = value.Execute(request);

// Retrieve the "Result" from the response, which contains audit storage info

var result = response.Results["Result"];

// Check if the result is not null

if (result != null)

{

// Use reflection to get the AuditStorageDetails property from the Result object

var auditStorageDetailsProp = result.GetType().GetProperty("AuditStorageDetails");

if (auditStorageDetailsProp != null)

{

// Get the value of the AuditStorageDetails property

var auditStorageDetailsValue = auditStorageDetailsProp.GetValue(result);

// Cast the value to IDictionary for iteration (AuditStorageDetails is a dictionary)

IDictionary auditStorageDict = (IDictionary)auditStorageDetailsValue;

// Log the total number of audit partitions

Console.WriteLine($"AuditStorageDetails contains {auditStorageDict.Count} entries");

// Loop through each entry in the AuditStorageDetails dictionary

foreach (DictionaryEntry entry in auditStorageDict)

{

// Log the key (usually the partition name or entity type)

Console.WriteLine($"--- Key: {entry.Key} ---");

// Get the value (AuditStorageDetails object) for this key

var auditDetail = entry.Value;

if (auditDetail != null)

{

// Get all properties of the AuditStorageDetails object

var props = auditDetail.GetType().GetProperties();

// Loop through each property and log its name and value

foreach (var prop in props)

{

var propValue = prop.GetValue(auditDetail);

Console.WriteLine($"{prop.Name}: {propValue}");

}

}

else

{

// Log if the auditDetail value is null

Console.WriteLine("Value is null");

}

// Separator for readability

Console.WriteLine("---------------------------------------------");

}

}

else

{

// Log if AuditStorageDetails property is not found

// Utility.SetTrace("AuditStorageDetails property not found in result.", workflowConfig, ref traceLog);

}

}

}

catch (Exception ex)

{

throw new Exception(ex.Message);

}

}

Step 3: Execute and Review Output

When you execute the code, it retrieves and displays audit storage information for each partition or entity.

Output

GetAuditStorageDetails Action

Note: When you first trigger the GetAuditStorageDetails Action, it may take some time to process — especially for large environments.


The Status field helps track progress:

Pending → The system is still compiling audit data.

Completed → The data is ready, and AuditStorageDetails contains the breakdown.

Once complete, the console output lists each entity or partition and its respective audit storage metrics.

Key Benefits of Using GetAuditStorageDetails

  • Provides clear visibility into how audit data is stored across entities
  • Helps in proactive storage management
  • Reduces risk of unexpected storage overages
  • Enables data-driven decisions for audit data retention

FAQs

  1. What does the GetAuditStorageDetails Action do in Dynamics 365?
    A. 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.
  2. Do I need special permissions to run the GetAuditStorageDetails Action?
    A. Yes. Only users with System Administrator or Audit-related privileges in Dataverse can execute the GetAuditStorageDetails Action.
  3. How long does the GetAuditStorageDetails Action take to process?
    A. 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 Pending. Once complete, it changes to Completed, and the audit details become available.
  4. Can I use the data from the GetAuditStorageDetails Action to clean up old audit logs?
    A. The data retrieved from the GetAuditStorageDetails Action only provides insights into storage usage; it doesn’t 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.

Conclusion

Understanding how audit data is stored is crucial for maintaining a healthy and optimized Dynamics 365 environment.

By using the GetAuditStorageDetails action, developers and administrators can:

  • Discover entity-specific and partition-level audit storage usage.
  • Monitor audit growth patterns.
  • Plan cleanup or retention strategies more effectively.

This method not only simplifies monitoring and troubleshooting, but also ensures that organizations maintain a balanced and efficient auditing process in the long run.

Category: Dynamics 365 Technical Tags:

About Sam Kumar

Sam Kumar is the Vice President of Marketing at Inogic, a Microsoft Gold ISV Partner renowned for its innovative apps for Dynamics 365 CRM and Power Apps. With a rich history in Dynamics 365 and Power Platform development, Sam leads a team of certified CRM developers dedicated to pioneering cutting-edge technologies with Copilot and Azure AI the latest additions. Passionate about transforming the CRM industry, Sam’s insights and leadership drive Inogic’s mission to change the “Dynamics” of CRM.