Access to Azure Data Lake Container by using a link - azure

Is it possible to share the contents of a container from azure data lake?
The goal is for anyone with the link to be able to download the files that are there.
Person who click the link should see folders and files which are there and has ability to download.

You need to enable Allow Blob public access setting and change access level of container to Container. You can refer to this documentation. Then you can use this URL to list blobs in container:https://myaccount.blob.core.windows.net/mycontainer?restype=container&comp=list. It will return xml file, you can copy the URL of blob and paste it in your browser to download it.
Update:
Yes, it's possible to use SAS key to do this while keeping your container is private.
You can generate SAS with list permission. And Use this URL to get blob list.
https://myaccount.blob.core.windows.net/mycontainer?mySAStoken&restype=container&comp=list
And you can download file with this:
https://myaccount.blob.core.windows.net/mycontainer/myfile?mySAStoken

Related

Zip multiple Azure Blob Storage Files and get its zip linked

I want to create functionality in my ASP .Net MVC application in which user will be able to download multiple AZ Blob files in zip folder. For doing this I've search for different scenario's.
Download multiple files through network stream and creating zip through that network stream.
Create zip file for multiple files in Azure and get that shareable links to download zip.
My problem is that AZ Blob Public Access Level is set Off. So, that's why I cant download all files through network stream because there is a chance that files might be corrupted due to access level.
I want my AZ function to zip my files on AZ Blob then I will share that zip link to the user to download the files as zip.
My problem is that AZ Blob Public Access Level is set Off. So, that's
why I cant download all files through network stream because there is
a chance that files might be corrupted due to access level.
If you set the Public Access Level to disable, then anonymous access to the blob will definitely be blocked. And if you pass the verification, you can access the blob without any problems.
I want my AZ function to zip my files on AZ Blob then I will share
that zip link to the user to download the files as zip.
Of course you can do this through azure function, but your storage settings make it impossible for any anonymous users to access the blob. Just giving the link is not enough, you need to make them pass the verification.
I suggest you do not access blobs based on link. Please use the code to generate the sas token, and obtain the zip file through the authentication of the sas token.

Viewing Stored Images in Azure Blobs

I have images that are stored in Blobs in Azure. Now I want to display them on a website. What would be the easiest way to display these images ?
Each blob has its own Url which you can retrieve from the Azure Portal or by using the Azure Storage Explorer.
You could save the Urls in your database and display them directly on your website like you would any other image Url.
If your web site requires a CDN, you could add an Azure CDN on top of your blob storage Like this.
Consider using SAS (shared access signature). it's short lived url and gives ability to view image for certian period. you can also provide permissions at granular level.
https://learn.microsoft.com/en-us/azure/storage/common/storage-dotnet-shared-access-signature-part-1
The easiest way is to change the blob container Public access level to Blob or container, then you can visit all the images in the container via link like "https://your_storage_account_name.blob.core.windows.net/your_container_name/your_image.JPG".
You can follow steps below:
1.In azure portal, nav to your storage account -> select the container which stores your image -> change the Public Access Level:
2.After set public access level, then you can use this link I mentioned above to visit your image. In your case, you can just put this link to your website.

Azure storage account, make the file public with public link to download file

I have developed an app for a client with an azure database, I have never before worked with azure so I have no idea what I'm doing, I am using the .NETAutoUpdater package as the updater and require the update file to be a zip on a public link. Is there any to do this using Azure Storage Accounts --> Blobs and just make the blob public with a link? again I have no idea what I am doing in azure so any assistance will be appreciated
Yes, this is definitely possible. From the list of your blobs, click the grey dots at the end of the line and choose "Change access level".
Then change the access level to "Blob". Now open the blob container and select its properties view.
As you can see it shows an URL like https://yourapp.blob.core.windows.net/yourblobcontainer. Files that are placed in this container will be downloadable via that URL. E.g. if you have a file named foo.bar it'll be available at https://yourapp.blob.core.windows.net/yourblobcontainer/foo.bar.
It is actually fairly simple and straightforward to do. Simply set the ACL of the blob container containing your zip file to either Blob (recommended) or Container and the blobs inside that container will be publicly accessible.
You can set the ACL of the blob container on the portal, using any available storage explorers or programmatically.

Serving Files From Azure Storage

I have a simple need, but there are so many azure options, I am not sure where to start.
I have a AppService (website) on azure from which I want to serve static PDFs for download. In other words, there is a training page on the website, and on this page, I want to have url to the PDF to download it.
But I don't want the PDF's to be a part of the AppService files, I want them in storage so they are a separate from the website files.
How should this be done?
What I have found so far is: Azure Blob storage, but it's not clear to me how to use those with a URL. The samples look like they are using code to download instead of a public URL.
I have also looked at Azure CDN, but that seems like more than I am looking for. Just need a simple location to store and download files.
You can make the blob container public so anyone with the link can download the file.
In this case you can just link to the file or return a 302 redirect from your app to the link, which also initiates the download.
Another option is to use SAS tokens.
These temporary tokens are generated using your storage account access key,
and are attached to the URL.
You can then give this final URL in the link to allow the user to download the file.
In this option the container can be kept private, and you control who can access what.
Now the token is only valid until it expires (you decide this time), so a user could give the link to another person and they could also download the document within that time.
The third option is to pipe the files through your app to the user.
Download the file from your back-end and then stream it to the user for download.
This option takes more resources on your back-end as threads and IO are used there for each download.
This option is the most secure as you can control who can download what.
you can upload your PDFs to Azure Blob storage into a special container (e.g. download) and make that container and content public in either of two ways:
public read access for blobs only: Blobs within the container can be read by anonymous request, but container data is not available. Anonymous clients cannot enumerate the blobs within the container.
Full public read access: All container and blob data can be read by anonymous request. Clients can enumerate blobs within the container by anonymous request, but cannot enumerate containers within the storage account.
Then they are accessible by a URL like https://yourStor.blob.core.windows.net/download/train1.pdf
To expand on the accepted answer
Create a Storage Account, such as mystorage
In the storage account, create a container, such as mycontainer
On the container, set the Access Policy to Blob (Anonymous read access for blobs only).
Upload your file, such as myfile.txt to the container.
View the file Properties. It will show the URL to the file which is in this format: https://mystorage.blob.core.windows.net/mycontainer/myfile.txt
Note that the URL is case sensitive.

Best Way to host dynamic image with Azure

I am working on a website where I need to dynamically host images. My intention is to host the images with full URL.
I tried CDN but come to know it has a limitation of that image will only be available 15 mins after upload.
Other options is Blob storage, when I read the document it says "Block blobs" are most ideal for image and media content. Therefore, I am trying to use that.
So, I've following questions:
What is the best way to host images on Azure for such requirements?
If I use Blob storage then how can I get the full URL so that I can that URL to load images in my product?
There really isn't a best way to store images. Some people store them in blob storage (as you referenced), some go with database engines... But, since you asked specifically about how to interact with blob storage and URI's:
All blobs are referenced by uri: http(s)://storagename.blob.core.windows.net/containername/blobname
You can set every blob to private or public (whether at blob or container level), and then either return URI's to your user/webpage (if public) or generate a Shared Access Policy or Shared Access Signature to temporariliy grant access to a private blob (I'll leave that as an exercise for you to look up).
It's completely up to you to create containers and blobs as needed. How you find a blob later is also up to you, so you'll need to think about how you store their names or their URIs (e.g. in a database table somewhere). You can always iterate through containers to search for a given blob, but that is time-consuming, vs direct-retrieval (again, assuming you've stored the URI as metadata somewhere in a database).

Resources