I am trying to access Azure Blob with SAS token to download the data from the blob, this is what I have tried.
I am very new to this so have no idea how it should work
this is what I have tried so far.
const string sasToken = "SAS TOKEN";
var blobUri = new System.Uri("URI");
var blobUriBuilder = new System.UriBuilder(blobUri)
{
Query = sasToken
};
var authorizedBlobUri = blobUriBuilder.Uri;
var blobClient = new BlobClient(authorizedBlobUri);
Console.WriteLine("blob read successfully: {0} ", blobClient.BlobContainerName);
// Create a local file in the ./data/ directory for uploading and downloading
string localPath = "./data/";
string fileName = "quickstart" + Guid.NewGuid().ToString() + ".txt";
string localFilePath = Path.Combine(localPath, fileName);
string downloadFilePath = localFilePath.Replace(".txt", "DOWNLOADED.txt");
var response = await blobClient.DownloadToAsync(downloadFilePath);
Console.WriteLine("blob read successfully: {0} {1}", response.Content, response.Status);
could you suggest if this is the right way to get data from the Blob and how to resolve this error I am getting please
