I frequently need to Enable and configure collecting performance counters remotely in my windows azure deployment, There are a few tasks you are trying to accomplish 1- Get all roles you have for your deployment 2- Get the Diagnostics manager associated with each instance of each role 3- Set your Windows Azure Diagnostics Settings. I created the following helper class to make it easier for me, hope you find it useful:) 1: #region Default Counters 2: static string [] defaultCounterNames = new string [] 3: { 4: @”MemoryAvailable Mbytes” , 5: @”Processor(_Total)% Processor Time” , 6: @”Processor(*)% Processor Time” , 7: @”Process(*)Working Set” , 8: @”Process(*)Private Bytes” , 9: @”Process(*)Working Set Peak” , 10: @”Process(*)Virtual Bytes” , 11: @”Process(*)Virtual Bytes Peak” 12: }; 13: #endregion 14: 15: public static void SetState( string connectionString, string deploymentId , int sampleRateInSeconds, int transferPeriodInSeconds, string [] counterNames = null ) 16: { 17: if (counterNames == null || counterNames.Length == 0) 18: { 19: counterNames = defaultCounterNames; 20: } 21: 22: CloudStorageAccount cloudStorageAccount = CloudStorageAccount.Parse(connectionString); 23: 24: //TODO: Need to remove this if HTTPS is enabled – this allows connecting though http, otherwise the connection will fail. 25: DeploymentDiagnosticManager.AllowInsecureRemoteConnections = true ; 26: 27: //Get the diagnostis manager associated with this blob storage