static void Main(string[] args)
        {
            var connectionString = "DefaultEndpointsProtocol=https;AccountName=azureblobsastest1;AccountKey=foexxYwYyzN3g+gDwr72oKX9eQy9XYCh9rg4j+NPcZnfwfKvggx/PN0k38pWFXJMC2MEmBwggUfPjaviPhNVwQ==;EndpointSuffix=core.windows.net";
            AzureResourceSasGenerator sasGenerator = new AzureResourceSasGenerator()
                                                     .With(connectionString)
                                                     .With(SharedAccessAccountPermissions.List | SharedAccessAccountPermissions.Read);

            var        token  = sasGenerator.GetStorageSasToken();
            UriBuilder sasUri = new UriBuilder()
            {
                Scheme = "https",
                Host   = string.Format("{0}.blob.core.windows.net", "azureblobsastest1"),
                Query  = token
            };
            var blobClient   = new CloudBlobClient(sasUri.Uri);
            var containerRef = blobClient.GetContainerReference("app1container");
            var blobRef      = containerRef.GetBlockBlobReference("blob.txt");
            var content      = blobRef.DownloadTextAsync().Result;

            Console.WriteLine(content);

            var file = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Guid.NewGuid() + ".txt");

            blobRef.DownloadToFileAsync(file, FileMode.Create).Wait();
            Console.Read();
        }
        public async Task SetDefaultData()
        {
            var             blobConfig       = GetBlobConfig();
            var             blobSasGenerator = new AzureResourceSasGenerator(blobConfig).With(SharedAccessAccountPermissions.Write | SharedAccessAccountPermissions.Create);
            var             accessToken      = blobSasGenerator.GetStorageSasToken();
            CloudBlobClient blobClient       = GetClient(accessToken);
            var             containerRef     = blobClient.GetContainerReference("app1container");
            await containerRef.CreateIfNotExistsAsync();

            var blobRef = containerRef.GetBlockBlobReference("blob1.txt");
            await blobRef.UploadTextAsync("SomeText");
        }
        public void GenerateReadAccessSasToken_ValidToken_ReadSuccessful()
        {
            //arrrange
            var             blobConfig       = GetBlobConfig();
            var             blobSasGenerator = new AzureResourceSasGenerator(blobConfig);
            var             accessToken      = blobSasGenerator.GetStorageSasToken();
            CloudBlobClient blobClient       = GetClient(accessToken);
            var             containerRef     = blobClient.GetContainerReference("app1container");
            var             blobRef          = containerRef.GetBlockBlobReference("blob.txt");


            //act
            var content = blobRef.DownloadTextAsync().Result;

            //assert
            Assert.IsNotNull(content);
        }