/// <summary>
        /// Create a cloud storage account using an ARM storage management client
        /// </summary>
        /// <param name="storageClient">The client to use to get storage account details.</param>
        /// <param name="resourceGroupName">The resource group contining the storage account.</param>
        /// <param name="accountName">The name of the storage account.</param>
        /// <returns>A CloudStorageAccount that can be used by windows azure storage library to manipulate objects in the storage account.</returns>
        public static CloudStorageAccount GenerateCloudStorageAccount(Arm.IStorageManagementClient storageClient,
                                                                      string resourceGroupName, string accountName)
        {
            if (!TestMockSupport.RunningMocked)
            {
                var storageServiceResponse = storageClient.StorageAccounts.GetProperties(resourceGroupName, accountName);
                Uri blobEndpoint           = storageServiceResponse.StorageAccount.PrimaryEndpoints.Blob;
                Uri queueEndpoint          = storageServiceResponse.StorageAccount.PrimaryEndpoints.Queue;
                Uri tableEndpoint          = storageServiceResponse.StorageAccount.PrimaryEndpoints.Table;
                Uri fileEndpoint           = storageServiceResponse.StorageAccount.PrimaryEndpoints.File;

                return(new CloudStorageAccount(
                           GenerateStorageCredentials(storageClient, resourceGroupName, accountName),
                           blobEndpoint,
                           queueEndpoint,
                           tableEndpoint,
                           fileEndpoint));
            }
            else
            {
                return(new CloudStorageAccount(
                           new StorageCredentials(accountName,
                                                  Convert.ToBase64String(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString()))),
                           new Uri(string.Format("https://{0}.blob.core.windows.net", accountName)),
                           new Uri(string.Format("https://{0}.queue.core.windows.net", accountName)),
                           new Uri(string.Format("https://{0}.table.core.windows.net", accountName)),
                           new Uri(string.Format("https://{0}.file.core.windows.net", accountName))));
            }
        }
 /// <summary>
 /// Create storage credentials for the given account
 /// </summary>
 /// <param name="storageClient">The ARM storage management client.</param>
 /// <param name="resourceGroupName">The resource group containing the storage account.</param>
 /// <param name="accountName">The storage account name.</param>
 /// <returns>Storage credentials for the given account.</returns>
 public static StorageCredentials GenerateStorageCredentials(Arm.IStorageManagementClient storageClient,
                                                             string resourceGroupName, string accountName)
 {
     if (!TestMockSupport.RunningMocked)
     {
         var storageKeysResponse = storageClient.StorageAccounts.ListKeys(resourceGroupName, accountName);
         return(new StorageCredentials(accountName,
                                       storageKeysResponse.StorageAccountKeys.Key1));
     }
     else
     {
         return(new StorageCredentials(accountName,
                                       Convert.ToBase64String(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString()))));
     }
 }