2

I am using Azure.Storage.Blobs, Version=12.1.0.0. Blobclient is working fine with AccessKey ,but we wanted to use SAS connectionstring It is throwing exception here.

var blobClient = new BlobServiceClient(**Connectionstring**);

"No valid combination of account information found." this is the exception am getting at the above line.

I am using the below SAS connection format BlobEndpoint=xxxxxxx;QueueEndpoint=xxxxxxx;FileEndpoint=xxxxxxx;TableEndpoint=xxxxxxx;SharedAccessSignature=xxxxxxx

0

1 Answer 1

4

For SAS connection, you should follow the steps below to generate sas-url: Nav to azure portal -> your storage account -> Shared access signature:

enter image description here

Then copy the "Blob Service SAS URL"(if you want to operate file share / queue, you should use the respective SAS URL).

Then in the code with library Azure.Storage.Blobs, Version=12.1.0.0.:

using Azure.Storage.Blobs;
using System;

namespace ConsoleApp16
{
    class Program
    {
        static void Main(string[] args)
        {
            //replace the sas_url with the one you copied in the above steps.
            string sas_url = "https://xxx.blob.core.windows.net/?sv=2019-02-02&ss=bfqt&srt=sco&sp=rwdlacup&se=2020-01-07T17:04:27Z&st=2020-01-07T09:04:27Z&spr=https&sig=xxx";
            Uri uri = new Uri(sas_url);
            BlobServiceClient blobServiceClient = new BlobServiceClient(uri);

            var blobContainer = blobServiceClient.GetBlobContainerClient("test1");

            var blobclient = blobContainer.GetBlobClient("yy1.txt");
            blobclient.Upload(@"d:\aa.txt");


            Console.WriteLine("**completed**");
            Console.ReadLine();
        }
    }
}
Sign up to request clarification or add additional context in comments.

2 Comments

@santhoshisirangi if the answer works for you, could you please help mark it as answer as per this link? Thanks.
@santhoshisirangi, Hello, since it's working now, could you please accept it as answer? Just take you around 3-4 seconds. And it's very important to me. Really thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.