Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

DirectoryConfiguration.DirectoryQuotaInMB Property

Updated: April 23, 2013

Gets or sets the maximum size of the directory defined by the Path property to which file-based logs are written.

Namespace: Microsoft.WindowsAzure.Diagnostics
Assembly: Microsoft.WindowsAzure.Diagnostics (in Microsoft.WindowsAzure.Diagnostics.dll)

public int DirectoryQuotaInMB { get; set; }

Property Value

Type: System.Int32

Returns Int32.

This property specifies the size of the local directory to which a role instance’s DiagnosticMonitor will store file-based diagnostics and logging data. By default, the DirectoryQuotaInMB is set to 1GB.

The size you specify for the DirectoryQuotaInMB property applies towards the OverallQuotaInMB property. Specifying a DirectoryQuotaInMB that is larger than the OverallQuotaInMB will result in an exception. If your role instance uses many logging directories, ensure that the combined size of each DirectoryQuotaInMB property is less than your OverallQuotaInMB value.


You use this property by creating a new DirectoryConfiguration object and assigning its DirectoryQuotaInMB property value:

// Create a new DirectoryConfiguration object.
DirectoryConfiguration directoryConfiguration = new DirectoryConfiguration();

// Add the directory size quota.
directoryConfiguration.DirectoryQuotaInMB = 2048;

The following code snippet demonstrates how to use the DirectoryQuotaInMB property in the context of a remotely updating a role’s diagnostics configuration. This snippet gets the diagnostics configuration of each instance in a specific role, creates a new DirectoryConfiguration object, specifies the container name for crash dumps, and sets the new configuration.

// Get the connection string. It's recommended that you store the connection string in your web.config or app.config file.
// Use the ConfigurationManager type to retrieve your storage connection string.  You can find the account name and key in
// the Azure Management Portal (http://manage.windowsazure.com).
//string connectionString = "DefaultEndpointsProtocol=https;AccountName=<AccountName>;AccountKey=<AccountKey>";
string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString;

// The deployment ID and role name for your application can be obtained from the 
// Azure Management Portal (http://manage.windowsazure.com). See your 
// application dashboard under Cloud Services.
string deploymentID = "e2ab8b6667644666ba627bdf6f5e4daa";
string roleName = "WebRole1";

// Get the DeploymentDiagnosticManager object for your deployment.
DeploymentDiagnosticManager diagManager = new DeploymentDiagnosticManager(connectionString, deploymentID);

// Get the RoleInstanceDiagnosticManager objects for each instance of your role.
IEnumerable<RoleInstanceDiagnosticManager> instanceManagers = diagManager.GetRoleInstanceDiagnosticManagersForRole(roleName);

// Iterate through the role instances and update the configuration.
foreach (RoleInstanceDiagnosticManager roleInstance in instanceManagers)
   DiagnosticMonitorConfiguration diagnosticConfiguration = roleInstance.GetCurrentConfiguration();

   // Create a new DirectoryConfiguration object.
   DirectoryConfiguration directoryConfiguration = new DirectoryConfiguration();

   // Add the name for the blob container in Azure storage.
   directoryConfiguration.Container = "wad-crash-dumps";

   // Add the directory size quota for the blob container.
   directoryConfiguration.DirectoryQuotaInMB = 2048;

   // Add the directoryConfiguration to the Directories collection.

   // Schedule a transfer period of 30 minutes.
   diagnosticConfiguration.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(30.0);

   // Set the configuration.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Development Platforms

Windows Vista, Windows 7, Windows Server 2008, Windows 8.1, Windows Server 2012 R2, Windows 8 and Windows Server 2012

Target Platforms

Community Additions

© 2015 Microsoft