DeploymentDiagnosticManager.GetRoleInstanceDiagnosticManager Method (String, String)

 

Returns a RoleInstanceDiagnosticManager for the specified role instance.

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

Syntax

public RoleInstanceDiagnosticManager GetRoleInstanceDiagnosticManager(
    string roleName,
    string roleInstanceId
)
public:
RoleInstanceDiagnosticManager^ GetRoleInstanceDiagnosticManager(
    String^ roleName,
    String^ roleInstanceId
)
member GetRoleInstanceDiagnosticManager : 
        roleName:string *
        roleInstanceId:string -> RoleInstanceDiagnosticManager
Public Function GetRoleInstanceDiagnosticManager (
    roleName As String,
    roleInstanceId As String
) As RoleInstanceDiagnosticManager

Parameters

Return Value

Type: Microsoft.WindowsAzure.Diagnostics.Management.RoleInstanceDiagnosticManager

Type: Microsoft.WindowsAzure.Diagnostics.Management.RoleInstanceDiagnosticManager

Type: Microsoft.WindowsAzure.Diagnostics.Management.RoleInstanceDiagnosticManager

Remarks

The GetRoleInstanceDiagnosticManager method creates a RoleInstanceDiagnosticManager object that can manage the diagnostics of a running role instance. You specify the name of the role and the role instance ID for a role you want to manage. Both of these parameters can be retrieved from the Management Portal or by using the Get Cloud Service Properties operation of the Service Management API.

This method will return a RoleInstanceDiagnosticManager object only for the specified role instance. If you want to make diagnostic changes to all role instances for a particular role, you can use the GetRoleInstanceDiagnosticManagersForRole method.

The following code snippet creates a role instance diagnostic manager.

// 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 Windows Azure  (https://manage.windowsazure.com).
//string connectionString = "DefaultEndpointsProtocol=https;AccountName=<AccountName>;AccountKey=<AccountKey>";
string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString;

// You can find the deployment ID, role name, and role instance ID in the 
// Windows Azure  (https://manage.windowsazure.com).
string deploymentId = "28267ed8caf3424eab3f0b01acdd7281";
string roleName = "WebRole1";
string roleInstanceId = "WebRole1_IN_0";

// Create a DeploymentDiagnosticManager for the deployment.
DeploymentDiagnosticManager deploymentDiagnosticManager = new DeploymentDiagnosticManager(connectionString, deploymentId);

// Get the diagnostic manager for the specified role instance.
RoleInstanceDiagnosticManager roleInstanceDiagnosticManager = deploymentDiagnosticManager.GetRoleInstanceDiagnosticManager(roleName, roleInstanceId);

Warning

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

DeploymentDiagnosticManager Class
Microsoft.WindowsAzure.Diagnostics.Management Namespace

Return to top