I am getting the 3 Exceptions below when downloading a .csv file from Azure Data lake storage gen 2 from VM machine
Inner Exception 1:
StorageException: The requested name is valid, but no data of the requested type was found.
Inner Exception 2:
HttpRequestException: The requested name is valid, but no data of the requested type was found.
Inner Exception 3:
SocketException: The requested name is valid, but no data of the requested type was found.
Here it is the code I written to download the file
public static string[] downloadContentsFromBlob(string blobAccountName, string blobAccountKey, string containerName, string blobFileName, string blobStoragePath)
{
Console.WriteLine("Inside download contents from Blob()");
//string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "TestData/Downloads/");
string connectionString = $"DefaultEndpointsProtocol=https;AccountName=" + blobAccountName + ";AccountKey=" + blobAccountKey + ";EndpointSuffix=core.windows.net";
// Setup the connection to the storage account
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(connectionString);
// Connect to the blob storage
Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient serviceClient = storageAccount.CreateCloudBlobClient();
// Connect to the blob container
Microsoft.WindowsAzure.Storage.Blob.CloudBlobContainer container = serviceClient.GetContainerReference($"{containerName}");
// Connect to the blob file
Microsoft.WindowsAzure.Storage.Blob.CloudBlockBlob blob = container.GetBlockBlobReference($"{blobStoragePath + blobFileName}");
// provide the file download location below
string contents = blob.DownloadTextAsync().Result;
Console.WriteLine("Contents from Blob has been Downloaded!");
return ConvertStringToStringArray(contents);
}