private void SetApplicationDiagnosticsSettings( string name, WebsiteDiagnosticOutput output, bool setFlag, Dictionary <DiagnosticProperties, object> properties = null) { Site website = GetWebsite(name); using (HttpClient client = CreateDeploymentHttpClient(website.Name)) { DiagnosticsSettings diagnosticsSettings = GetApplicationDiagnosticsSettings(website.Name); switch (output) { case WebsiteDiagnosticOutput.FileSystem: diagnosticsSettings.AzureDriveTraceEnabled = setFlag; diagnosticsSettings.AzureDriveTraceLevel = setFlag ? (LogEntryType)properties[DiagnosticProperties.LogLevel] : diagnosticsSettings.AzureDriveTraceLevel; break; case WebsiteDiagnosticOutput.StorageTable: diagnosticsSettings.AzureTableTraceEnabled = setFlag; if (setFlag) { const string storageTableName = "CLOUD_STORAGE_ACCOUNT"; string storageAccountName = (string)properties[DiagnosticProperties.StorageAccountName]; string connectionString = cloudServiceClient.GetStorageServiceConnectionString( storageAccountName); SetConnectionString(website.Name, storageTableName, connectionString, DatabaseType.Custom); diagnosticsSettings.AzureTableTraceLevel = setFlag ? (LogEntryType)properties[DiagnosticProperties.LogLevel] : diagnosticsSettings.AzureTableTraceLevel; } break; default: throw new ArgumentException(); } JObject json = new JObject( new JProperty(UriElements.AzureDriveTraceEnabled, diagnosticsSettings.AzureDriveTraceEnabled), new JProperty(UriElements.AzureDriveTraceLevel, diagnosticsSettings.AzureDriveTraceLevel.ToString()), new JProperty(UriElements.AzureTableTraceEnabled, diagnosticsSettings.AzureTableTraceEnabled), new JProperty(UriElements.AzureTableTraceLevel, diagnosticsSettings.AzureTableTraceLevel.ToString())); client.PostJson(UriElements.DiagnosticsSettings, json, Logger); } }