public override void ExecuteCmdlet() { var properties = new Dictionary <DiagnosticProperties, object>(); properties[DiagnosticProperties.LogLevel] = LogLevel; if (File.IsPresent) { WebsitesClient.EnableApplicationDiagnostic(Name, WebsiteDiagnosticOutput.FileSystem, properties, Slot); } else if (Storage.IsPresent) { string storageName = string.IsNullOrEmpty(StorageAccountName) ? CurrentSubscription.CurrentStorageAccountName : StorageAccountName; properties[DiagnosticProperties.StorageAccountName] = storageName; WebsitesClient.EnableApplicationDiagnostic(Name, WebsiteDiagnosticOutput.StorageTable, properties, Slot); } else { throw new PSArgumentException(); } if (PassThru.IsPresent) { WriteObject(true); } }
public override void ExecuteCmdlet() { var properties = new Dictionary <DiagnosticProperties, object>(); properties[DiagnosticProperties.LogLevel] = LogLevel; if (File.IsPresent) { WebsitesClient.EnableApplicationDiagnostic(Name, WebsiteDiagnosticOutput.FileSystem, properties, Slot); } else if (TableStorage.IsPresent || BlobStorage.IsPresent) { if (string.IsNullOrWhiteSpace(StorageAccountName)) { properties[DiagnosticProperties.StorageAccountName] = Profile.Context.Subscription.GetStorageAccountName(); } else { properties[DiagnosticProperties.StorageAccountName] = StorageAccountName; } if (TableStorage.IsPresent) { properties[DiagnosticProperties.StorageTableName] = string.IsNullOrEmpty(StorageTableName) ? "websitesapplogs" + Name.ToLowerInvariant() : StorageTableName.ToLowerInvariant(); WebsitesClient.EnableApplicationDiagnostic(Name, WebsiteDiagnosticOutput.StorageTable, properties, Slot); } else { // Blob storage properties[DiagnosticProperties.StorageBlobContainerName] = string.IsNullOrEmpty(StorageBlobContainerName) ? "websitesapplogs-" + Name.ToLowerInvariant() : StorageBlobContainerName.ToLowerInvariant(); WebsitesClient.EnableApplicationDiagnostic(Name, WebsiteDiagnosticOutput.StorageBlob, properties, Slot); } } else { throw new PSArgumentException(); } if (PassThru.IsPresent) { WriteObject(true); } }
public override void ExecuteCmdlet() { WebsitesClient = WebsitesClient ?? new WebsitesClient(CurrentSubscription, WriteDebug); switch (Type) { case WebsiteDiagnosticType.Site: WebsitesClient.EnableSiteDiagnostic( Name, WebServerLogging, DetailedErrorMessages, FailedRequestTracing); break; case WebsiteDiagnosticType.Application: Dictionary <DiagnosticProperties, object> properties = new Dictionary <DiagnosticProperties, object>(); properties[DiagnosticProperties.LogLevel] = LogLevel; if (Output == WebsiteDiagnosticOutput.StorageTable) { string storageName = string.IsNullOrEmpty(StorageAccountName) ? CurrentSubscription.CurrentStorageAccount : StorageAccountName; properties[DiagnosticProperties.StorageAccountName] = storageName; } WebsitesClient.EnableApplicationDiagnostic(Name, Output, properties); break; default: throw new PSArgumentException(); } if (PassThru.IsPresent) { WriteObject(true); } }