/// <summary>
        ///
        /// </summary>
        /// <param name="accountName"></param>
        /// <param name="accountKey"></param>
        /// <param name="vhdUri"></param>
        /// <param name="azureDriveCacheDirName"></param>
        /// <param name="azureDriveCacheSizeInMB"></param>
        /// <param name="azureDriveSizeInMB"></param>
        /// <param name="driveOptions"></param>
        /// <returns></returns>
        public static string MountAzureDrive(string accountName, string accountKey, Uri vhdUri, string azureDriveCacheDirName, int azureDriveCacheSizeInMB, int azureDriveSizeInMB, DriveMountOptions driveOptions, out bool wasAlreadyMounted)
        {
            // StorageCredentialsAccountAndKey credentials = new StorageCredentialsAccountAndKey(accountName, accountKey);
            CloudStorageAccount csa = WAStorageHelper.GetCloudStorageAccount(accountName, accountKey, false);

            return(MountAzureDrive(csa, vhdUri, azureDriveCacheDirName, azureDriveCacheSizeInMB, azureDriveSizeInMB, driveOptions, out wasAlreadyMounted));
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="accountName"></param>
        /// <param name="accountKey"></param>
        /// <param name="azureDriveContainerName"></param>
        /// <param name="azureDrivePageBlobName"></param>
        /// <param name="?"></param>
        /// <returns></returns>
        public static string SnapshotAzureDrive(string accountName, string accountKey, string azureDriveContainerName, string azureDrivePageBlobName)
        {
            try
            {
                CloudStorageAccount csa = WAStorageHelper.GetCloudStorageAccount(accountName, accountKey, false);
                // Create the blob client

                CloudBlobClient client = csa.CreateCloudBlobClient();
                // Create the blob container which will contain the pageblob corresponding to the azure drive.
                CloudBlobContainer container = client.GetContainerReference(azureDriveContainerName);
                container.CreateIfNotExist();

                // Get the page blob reference which will be used by the azure drive.
                CloudPageBlob blob  = container.GetPageBlobReference(azureDrivePageBlobName);
                CloudDrive    drive = new CloudDrive(blob.Uri, csa.Credentials);
                if (drive != null)
                {
                    return(drive.Snapshot().ToString());
                }
            }
            catch (Exception ex)
            {
                WindowsAzureSystemHelper.LogError(String.Format("Error in snapshot drive  {0} - {1}", azureDrivePageBlobName, ex.Message));
            }

            return(string.Empty);
        }
        private void DeleteTable()
        {
            string statusMessage = String.Empty;

            if (txtDeleteTable.Text.Length > 0)
            {
                try
                {
                    WAStorageHelper storageHelper = GetWAStorageHelper();
                    storageHelper.DeleteTable(txtDeleteTable.Text);
                    statusMessage = "Table deleted successfully.";
                    ListTables();
                }
                catch (DataServiceRequestException ex)
                {
                    statusMessage = "Unable to connect to the table storage server. Please check that the service is running.<br>"
                                    + ex.Message;
                }
            }
            else
            {
                statusMessage = "Please select a table name to delete.";
            }
            lblStatus.Text = statusMessage;
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="accountName"></param>
 /// <param name="accountKey"></param>
 /// <param name="uriString"></param>
 public static void DeleteAzureDrive(string accountName, string accountKey, string uriString)
 {
     try
     {
         CloudStorageAccount csa   = WAStorageHelper.GetCloudStorageAccount(accountName, accountKey, false);
         CloudDrive          drive = new CloudDrive(new Uri(uriString), csa.Credentials);
         if (drive != null)
         {
             drive.Delete();
         }
     }
     catch (Exception ex)
     {
         WindowsAzureSystemHelper.LogError(String.Format("Error deleting drive with Uri {0} - {1}", uriString, ex.Message));
     }
 }
        /// <summary>
        /// Snapshot the drive
        /// </summary>
        /// <param name="accountName"></param>
        /// <param name="accountKey"></param>
        /// <param name="uriString"></param>
        public static string SnapshotAzureDrive(string accountName, string accountKey, string uriString)
        {
            try
            {
                CloudStorageAccount csa   = WAStorageHelper.GetCloudStorageAccount(accountName, accountKey, false);
                CloudDrive          drive = new CloudDrive(new Uri(uriString), csa.Credentials);
                if (drive != null)
                {
                    return(drive.Snapshot().ToString());
                }
            }
            catch (Exception ex)
            {
                WindowsAzureSystemHelper.LogError(String.Format("Error in snapshot drive with Uri {0} - {1}", uriString, ex.Message));
            }

            return(string.Empty);
        }
        private void ListTables()
        {
            string statusMessage = String.Empty;


            try
            {
                WAStorageHelper storageHelper = GetWAStorageHelper();
                lbListTables.DataSource = storageHelper.ListTables();
                lbListTables.DataBind();
            }
            catch (DataServiceRequestException ex)
            {
                statusMessage = "Unable to connect to the table storage server. Please check that the service is running.<br>"
                                + ex.Message;
            }

            lblStatus.Text = statusMessage;
        }