/// <summary> /// The Check Name Availability operation checks if a storage account /// name is available for use in Windows Azure. (see /// http://msdn.microsoft.com/en-us/library/windowsazure/jj154125.aspx /// for more information) /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.WindowsAzure.Management.Storage.IStorageAccountOperations. /// </param> /// <param name='accountName'> /// The desired storage account name to check for availability. /// </param> /// <returns> /// The response to a storage account check name availability request. /// </returns> public static CheckNameAvailabilityResponse CheckNameAvailability(this IStorageAccountOperations operations, string accountName) { try { return(operations.CheckNameAvailabilityAsync(accountName).Result); } catch (AggregateException ex) { if (ex.InnerExceptions.Count > 1) { throw; } else { throw ex.InnerException; } } }
/// <summary> /// Checks that account name is valid and is not in use. /// </summary> /// <param name='operations'> /// Reference to the /// Microsoft.Azure.Management.Storage.IStorageAccountOperations. /// </param> /// <param name='accountName'> /// Required. The name of the storage account within the specified /// resource group. Storage account names must be between 3 and 24 /// characters in length and use numbers and lower-case letters only. /// </param> /// <returns> /// The CheckNameAvailability operation response. /// </returns> public static Task <CheckNameAvailabilityResponse> CheckNameAvailabilityAsync(this IStorageAccountOperations operations, string accountName) { return(operations.CheckNameAvailabilityAsync(accountName, CancellationToken.None)); }