/// <summary> /// Sets the configuration value. /// </summary> /// <param name="value">The value.</param> /// <returns><c>true</c> if the value was set; otherwise, <c>false</c>.</returns> private bool SetConfigurationValue(string value) { if (this.CloudStorageAccount == null) { // first time CloudStorageAccount initialAccount; if (CloudStorageAccount.TryParse(value, out initialAccount)) { this.credentials = new MutableStorageCredentials(initialAccount.Credentials); this.CloudStorageAccount = new CloudStorageAccount( this.credentials, initialAccount.BlobEndpoint, initialAccount.QueueEndpoint, initialAccount.TableEndpoint); } else { System.Diagnostics.Trace.TraceError("Error parsing storage account information - staying uninitialized"); } } else { // key rotation CloudStorageAccount newAccount; if (CloudStorageAccount.TryParse(value, out newAccount)) { if ((newAccount.BlobEndpoint != CloudStorageAccount.BlobEndpoint) || (newAccount.QueueEndpoint != CloudStorageAccount.QueueEndpoint) || (newAccount.TableEndpoint != CloudStorageAccount.TableEndpoint)) { System.Diagnostics.Trace.TraceWarning("Rejecting change: Endpoint(s) changed when updating storage account."); return(false); } this.credentials.UpdateWith(newAccount.Credentials); } else { System.Diagnostics.Trace.WriteLine("Error parsing storage account information - staying unchanged"); } } return(true); }
/// <summary>Sets the configuration value.</summary> /// <param name="value">The value. </param> /// <returns><c>true</c> if the value was set; otherwise, <c>false</c> . </returns> private bool SetConfigurationValue(string value) { if (this.CloudStorageAccount == null) { // first time CloudStorageAccount initialAccount; if (TryParse(value, out initialAccount)) { this.credentials = new MutableStorageCredentials(initialAccount.Credentials); this.CloudStorageAccount = new CloudStorageAccount( this.credentials, initialAccount.BlobEndpoint, initialAccount.QueueEndpoint, initialAccount.TableEndpoint); } else { Trace.TraceError("Error parsing storage account information - staying uninitialized"); } } else { // key rotation CloudStorageAccount newAccount; if (TryParse(value, out newAccount)) { if ((newAccount.BlobEndpoint != this.CloudStorageAccount.BlobEndpoint) || (newAccount.QueueEndpoint != this.CloudStorageAccount.QueueEndpoint) || (newAccount.TableEndpoint != this.CloudStorageAccount.TableEndpoint)) { Trace.TraceWarning("Rejecting change: Endpoint(s) changed when updating storage account."); return false; } this.credentials.UpdateWith(newAccount.Credentials); } else { Trace.WriteLine("Error parsing storage account information - staying unchanged"); } } return true; }