azure-storage-blobs

Downloading Azure Blob files in MVC3

半世苍凉 提交于 2019-12-03 02:44:32
问题 Our ASP.NET MVC 3 application is running on Azure and using Blob as file storage. I have the upload part figured out. The View is going to have the File Name, which, when clicked will prompt the file download screen to appear. Can anyone tell me how to go about doing this? 回答1: Two options really... the first is to just redirect the user to the blob directly (if the blobs are in a public container). That would look a bit like: return Redirect(container.GetBlobReference(name).Uri.AbsoluteUri);

Asynchronous download of an Azure blob to string with .NET 4.5 async, await

℡╲_俬逩灬. 提交于 2019-12-03 02:31:58
I'm trying to implement a fully asynchronous blob download with .NET 4.5 async & await. Let's assume the entire blob can fit in memory at once, and we want to hold it in a string . Code: public async Task<string> DownloadTextAsync(ICloudBlob blob) { using (Stream memoryStream = new MemoryStream()) { IAsyncResult asyncResult = blob.BeginDownloadToStream(memoryStream, null, null); await Task.Factory.FromAsync(asyncResult, (r) => { blob.EndDownloadToStream(r); }); memoryStream.Position = 0; using (StreamReader streamReader = new StreamReader(memoryStream)) { // is this good enough? return

How Do I Backup Azure Tables and Blobs

故事扮演 提交于 2019-12-03 02:16:10
I store data in Azure Storage tables and blob storage. I would like to automatically backup my data to protect against accidental data corruption by users or by a software issue. There isn't a good solution for this from Microsoft and, while there are paid solutions for automatic backups, it seems like there should be a straight-forward way to backup and restore this data. After doing a lot of research on the best way to automatically backup data, I found that the easiest way to do this is to schedule a job in the Windows Task Scheduler on an Azure virtual machine that uses AZCopy. AZCopy does

How to restrict azure blob container creation using SAS

对着背影说爱祢 提交于 2019-12-02 22:27:32
问题 How to set permission to not create container, while generating Account SAS token? Here is my settings. // Create a new access policy for the account. SharedAccessAccountPolicy policy = new SharedAccessAccountPolicy() { Permissions = SharedAccessAccountPermissions.Read | SharedAccessAccountPermissions.Write, Services = SharedAccessAccountServices.Blob | SharedAccessAccountServices.Table, ResourceTypes = SharedAccessAccountResourceTypes.Service | SharedAccessAccountResourceTypes.Container |

Upload and Delete Azure Storage Blob using azure-storage-blob or azure-storage

假如想象 提交于 2019-12-02 21:12:19
问题 I refer to Microsoft's Quick Start guide for Azure Blob storage client library v12 for Python. It details how to upload a blob but I want to delete a blob. This answer recommends using: from azure.storage.blob import BlobService blob_service = BlobService(account_name=accountName, account_key=accountKey) blob_service.delete_blob(container_name, blob_name) However, I tried but I got the following error: ImportError: cannot import name 'BlobService' from 'azure.storage.blob' Another answer

Upload to Azure Blob Storage with Shared Access Key

江枫思渺然 提交于 2019-12-02 19:27:03
UPD: Here is my implemented solution to this problem I'm trying to upload to Azure blob storage via Azure.Storage library (not REST API) and authenticating via Shared Access Key. I have seen this blog post , but the API has changed since the post and now I can't get the same result. Here is what I have: var blobClient = new CloudBlobClient(new Uri(blobWithSas.BaseUri), new StorageCredentials(blobWithSas.Sas)); // here I receive 404 error var blob = blobClient.GetBlobReferenceFromServer(new Uri(blobWithSas.AbsoluteUri)); using (var stream = new FileStream(fullFilePath, FileMode.Open)) { blob

How do I upload some file into Azure blob storage without writing my own program?

人走茶凉 提交于 2019-12-02 17:51:44
I created an Azure Storage account. I have a 400 megabytes .zip file that I want to put into blob storage for later use. How can I do that without writing code? Is there some interface for that? Free tools: Visual Studio 2010 -- install Azure tools and you can find the blobs in the Server Explorer Cloud Berry Lab's CloudBerry Explorer for Azure Blob Storage ClumpsyLeaf CloudXplorer Azure Storage Explorer from CodePlex (try version 4 beta) There was an old program called Azure Blob Explorer or something that no longer works with the new Azure SDK. Out of these, I personally like CloudBerry

How display a list of Azure blob of a Container in Silverlight application?

无人久伴 提交于 2019-12-02 16:11:31
问题 How display a list of Azure blob of a Container in Silverlight application? I know how to do it in regular .Net but I need it in Silverlight . I'm able to upload but I want to show a list of what already uploaded . Something like this but for Silverlight: CloudStorageAccount account = CloudStorageAccount.FromConfigurationSetting("DataConnectionString"); CloudBlobClient blobClient = account.CreateCloudBlobClient(); IEnumerable<CloudBlobContainer> containers = blobClient.ListContainers() Thanks

ARM Template containing config settings for web app

我们两清 提交于 2019-12-02 15:10:14
问题 I am encountering strange behavior when deploying an ARM template. I have the following template: (Note that sasUrl value 'xxx' has a real, working value in my file) { "name": "[variables('webAppServiceName')]", "type": "Microsoft.Web/sites", "location": "[resourceGroup().location]", "apiVersion": "2016-08-01", "dependsOn": [ "[concat('Microsoft.Web/serverfarms/', variables('appServicePlanName'))]" ], "tags": { "[concat('hidden-related:', resourceGroup().id, '/providers/Microsoft.Web

How to restrict azure blob container creation using SAS

夙愿已清 提交于 2019-12-02 12:59:56
How to set permission to not create container, while generating Account SAS token? Here is my settings. // Create a new access policy for the account. SharedAccessAccountPolicy policy = new SharedAccessAccountPolicy() { Permissions = SharedAccessAccountPermissions.Read | SharedAccessAccountPermissions.Write, Services = SharedAccessAccountServices.Blob | SharedAccessAccountServices.Table, ResourceTypes = SharedAccessAccountResourceTypes.Service | SharedAccessAccountResourceTypes.Container | SharedAccessAccountResourceTypes.Object, SharedAccessExpiryTime = DateTime.UtcNow.AddMinutes(2),