Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure Storage - File on Public URL

I am using Azure Storage to save some files. I want these files to be publicly available on a temporary basis. Currently, I'm saving them via an azure storage file service. Each file is give a URL of the structure ./[file-share]/[directory]/[file-name].[ext].

My question is, is there a way to make this URL publicly available? I do not see a way. If there isn't, is there some recommended way to make a file public available? I do not see a way to do this via a file service.

like image 333
user687554 Avatar asked Jun 19 '17 14:06

user687554


People also ask

How do I give public access to Azure blob storage?

Navigate to your storage account overview in the Azure portal. Under Data storage on the menu blade, select Blob containers. Select the containers for which you want to set the public access level. Use the Change access level button to display the public access settings.

Can you access Azure file share from browser?

A file share can be accessed via browser if the application uses REST APIs. Attachments: Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

How do I access blob storage from URL?

By default, the URL for accessing the Blob service in a storage account is https://<your account name>. blob.core.windows.net. You can map your own domain or subdomain to the Blob service for your storage account so that users can reach it using the custom domain or subdomain.

How do I download an Azure blob storage file by URL?

In order to download an Azure BLOB Storage item by its URL, you need to instantiate a CloudBlockBlob yourself using the item's URL: var blob = new CloudBlockBlob(new Uri(pdfFileUrl), cloudStorageAccount. Credentials); This blob can then be downloaded with the code you originally posted.


1 Answers

My question is, is there a way to make this URL publicly available?

One possible solution would be to create a Shared Access Signature (SAS) on the file in question with at least Read permission and share SAS URL with your users. You mentioned that you want the file to be publicly available on a temporary basis and for that SAS would perfectly fit the bill. You can set the SAS expiry based on your needs and once the SAS token expires, the file will no longer be available.

Other option would be to use Blob Storage instead of File Service. Here not only you can use Shared Access Signature but also change the container's ACL. By making the container's ACL as Blob, the blob (file) will be publicly available.

like image 85
Gaurav Mantri Avatar answered Sep 17 '22 22:09

Gaurav Mantri