RoleInstanceDiagnosticManager.SetCurrentConfiguration Method (DiagnosticMonitorConfiguration)


Sets the configuration for the diagnostic monitor.

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


public void SetCurrentConfiguration(
    DiagnosticMonitorConfiguration newConfiguration
void SetCurrentConfiguration(
    DiagnosticMonitorConfiguration^ newConfiguration
member SetCurrentConfiguration : 
        newConfiguration:DiagnosticMonitorConfiguration -> unit
Public Sub SetCurrentConfiguration (
    newConfiguration As DiagnosticMonitorConfiguration



The SetCurrentConfiguration method is used to set a new configuration for the diagnostic monitor of a role instance. See DiagnosticMonitorConfiguration for more information.

Setting the current configuration while on-demand transfers are pending results in an error.


The following code snippet gets the current diagnostic monitor configuration for a role instance, modifies it, and sets it.

// Get the diagnostic monitor for the specified role instance.
RoleInstanceDiagnosticManager roleInstanceDiagnosticManager = 
         new RoleInstanceDiagnosticManager(myStorageAccount, 

// Get the current diagnostic monitor for the role.
DiagnosticMonitorConfiguration currentConfiguration = roleInstanceDiagnosticManager.GetCurrentConfiguration();

// Use 30 seconds for the performance counter sample rate.
TimeSpan perfSampleRate = TimeSpan.FromSeconds(30.0);

// Add a performance counter for processor time to the current configuration.
currentConfiguration.PerformanceCounters.DataSources.Add(new PerformanceCounterConfiguration()
      CounterSpecifier = @"\Processor(_Total)\% Processor Time",
      SampleRate = perfSampleRate

// Apply the modified configuration to the diagnostic monitor for the role instance.


This API is not supported in Azure SDK versions 2.5 and higher. Instead, use the diagnostics.wadcfg XML configuration file. For more information, see Collect Logging Data by Using Azure Diagnostics.

See Also

Troubleshooting Guide

See Also

RoleInstanceDiagnosticManager Class
Microsoft.WindowsAzure.Diagnostics.Management Namespace

Return to top