public static void SetServiceProperties(Uri baseUri, StorageCredentials creds, StorageServiceProperties properties, bool useSharedKeyLite)
 {
     var req = CreateServicePropertiesRequest(baseUri);
     req.Method = "PUT";
     var ms = new MemoryStream();
     new XmlSerializer(typeof(StorageServiceProperties)).Serialize(ms, properties);
     ms.Position = 0;
     req.ContentLength = ms.Length;
     if (useSharedKeyLite) creds.SignRequestLite(req);
     else creds.SignRequest(req);
     using (var stream = req.GetRequestStream())
     {
         ms.CopyTo(stream);
     }
     using (var response = (HttpWebResponse)req.GetResponse())
     {
         if (response.StatusCode != HttpStatusCode.Accepted)
         {
             throw new Exception("Request failed to return 202 status code.");
         }
     }
 }
 public static CloudTableClient SetServiceProperties(this CloudTableClient client, StorageServiceProperties properties)
 {
     SetServiceProperties(client.BaseUri, client.Credentials, properties, true);
     return client;
 }
 public static CloudQueueClient SetServiceProperties(this CloudQueueClient client, StorageServiceProperties properties)
 {
     SetServiceProperties(GetBaseUriForQueues(client), client.Credentials, properties, false);
     return client;
 }