Ejemplo n.º 1
0
        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);
            }
        }