/// <summary>
        /// Query the Cross-Origin Resource Sharing (CORS) rules for the Table service
        /// </summary>
        /// <param name="tableClient"></param>
        private static async Task CorsSample(CloudTableClient tableClient)
        {
            Console.WriteLine();

            // Get service properties
            Console.WriteLine("Get service properties");
            ServiceProperties originalProperties = await tableClient.GetServicePropertiesAsync();

            try
            {
                // Add CORS rule
                Console.WriteLine("Add CORS rule");

                CorsRule corsRule = new CorsRule
                {
                    AllowedHeaders = new List <string> {
                        "*"
                    },
                    AllowedMethods = CorsHttpMethods.Get,
                    AllowedOrigins = new List <string> {
                        "*"
                    },
                    ExposedHeaders = new List <string> {
                        "*"
                    },
                    MaxAgeInSeconds = 3600
                };

                ServiceProperties serviceProperties = await tableClient.GetServicePropertiesAsync();

                serviceProperties.Cors.CorsRules.Add(corsRule);
                await tableClient.SetServicePropertiesAsync(serviceProperties);
            }
            finally
            {
                // Revert back to original service properties
                Console.WriteLine("Revert back to original service properties");
                await tableClient.SetServicePropertiesAsync(originalProperties);
            }
            Console.WriteLine();
        }
        /// <summary>
        /// Manage the properties of the Table service.
        /// </summary>
        /// <param name="tableClient"></param>
        private static async Task ServicePropertiesSample(CloudTableClient tableClient)
        {
            Console.WriteLine();

            // Get service properties
            Console.WriteLine("Get service properties");
            ServiceProperties originalProperties = await tableClient.GetServicePropertiesAsync();

            try
            {
                // Set service properties
                Console.WriteLine("Set service properties");

                ServiceProperties props = await tableClient.GetServicePropertiesAsync();

                props.Logging.LoggingOperations = LoggingOperations.Read | LoggingOperations.Write;
                props.Logging.RetentionDays     = 5;
                props.Logging.Version           = Constants.AnalyticsConstants.LoggingVersionV1;

                props.HourMetrics.MetricsLevel  = MetricsLevel.Service;
                props.HourMetrics.RetentionDays = 6;
                props.HourMetrics.Version       = Constants.AnalyticsConstants.MetricsVersionV1;

                props.MinuteMetrics.MetricsLevel  = MetricsLevel.Service;
                props.MinuteMetrics.RetentionDays = 6;
                props.MinuteMetrics.Version       = Constants.AnalyticsConstants.MetricsVersionV1;

                await tableClient.SetServicePropertiesAsync(props);
            }
            finally
            {
                // Revert back to original service properties
                Console.WriteLine("Revert back to original service properties");
                await tableClient.SetServicePropertiesAsync(originalProperties);
            }
            Console.WriteLine();
        }
 public Task SetServicePropertiesAsync(ServiceProperties properties, TableRequestOptions requestOptions, OperationContext operationContext, CancellationToken cancellationToken)
 {
     return(cloudTableClientImplementation.SetServicePropertiesAsync(properties, requestOptions, operationContext, cancellationToken));
 }